[ 
https://issues.apache.org/jira/browse/FLINK-4563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15525713#comment-15525713
 ] 

Anton Mushin commented on FLINK-4563:
-------------------------------------

Hello.
Do I correct undestand this issue, what next tests will be passed
{code:java}
@Test
        public void filteringForMultipleReporters() {
                Configuration config = new Configuration();
                config.setString(ConfigConstants.METRICS_SCOPE_NAMING_TM, 
"A.B.C.D");
                config.setString(ConfigConstants.METRICS_REPORTERS_LIST, 
"test1,test2");
                config.setString(ConfigConstants.METRICS_REPORTER_PREFIX + 
"test1." + ConfigConstants.METRICS_REPORTER_CLASS_SUFFIX, 
TestReporter1.class.getName());
                config.setString(ConfigConstants.METRICS_REPORTER_PREFIX + 
"test2." + ConfigConstants.METRICS_REPORTER_CLASS_SUFFIX, 
TestReporter2.class.getName());

                MetricRegistry registry = new MetricRegistry(config);
                TaskManagerMetricGroup tmGroup = new 
TaskManagerMetricGroup(registry, "host", "id");
                tmGroup.counter(1);

                registry.shutdown();
        }

        public static class TestReporter1 extends TestReporter {
                @Override
                public String filterCharacters(String input) {
                        return input.replace("A", "a");
                }

                @Override
                public void notifyOfAddedMetric(Metric metric, String 
metricName, MetricGroup group) {
                        assertEquals("a.B.C.D.1", 
group.getMetricIdentifier(metricName, this));
                }
        }

        public static class TestReporter2 extends TestReporter {
                @Override
                public String filterCharacters(String input) {
                        return input.replace("B", "b");
                }
                @Override
                public void notifyOfAddedMetric(Metric metric, String 
metricName, MetricGroup group) {
                        assertEquals("A.b.C.D.1", 
group.getMetricIdentifier(metricName,this));
                }
        }
{code}
and need save caching of scopeString in AbstractMetricGroup for each reporters ?

> [metrics] scope caching not adjusted for multiple reporters
> -----------------------------------------------------------
>
>                 Key: FLINK-4563
>                 URL: https://issues.apache.org/jira/browse/FLINK-4563
>             Project: Flink
>          Issue Type: Bug
>          Components: Metrics
>    Affects Versions: 1.1.0
>            Reporter: Chesnay Schepler
>            Assignee: Anton Mushin
>
> Every metric group contains a scope string, representing what entities 
> (job/task/etc.) a given metric belongs to, which is calculated on demand. 
> Before this string is cached a CharacterFilter is applied to it, which is 
> provided by the callee, usually a reporter. This was done since different 
> reporters have different requirements in regards to valid characters. The 
> filtered string is cached so that we don't have to refilter the string every 
> time.
> This all works fine with a single reporter; with multiple however it is 
> completely broken as only the first filter is ever applied.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to