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

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

I am understand. 
I planning to fix this issue after merge 
https://github.com/apache/flink/pull/2517 or when PR will be accept.

Now in AbstractMetricGroup#getMetricIdentifier() and for all calls 
getMetricIdentifier method scopeString once initialized.
{code:java}
public String getMetricIdentifier(String metricName, CharacterFilter filter) {
                if (scopeString == null) {
                        if (filter != null) {
                                scopeString = ScopeFormat.concat(filter, 
registry.getDelimiter(), scopeComponents);
                        } else {
                                scopeString = 
ScopeFormat.concat(registry.getDelimiter(), scopeComponents);
                        }
                }

                if (filter != null) {
                        return scopeString + registry.getDelimiter() + 
filter.filterCharacters(metricName);
                } else {
                        return scopeString + registry.getDelimiter() + 
metricName;
                }
        }
{code}
Do I need save this "caching" of scopeString for different filters? 
It is variable using in 3 places class: 
1 - in getMetricIdentifier() method
2 - in addGroup() method
3 - in addMetric() method
For 2 and 3 cases 'scopeString' using for logging
{code:title=Example} 
LOG.warn("Name collision: Adding a metric with the same name as a metric 
subgroup: '" +
                                                                name + "'. 
Metric might not get properly reported. (" + scopeString + ')');
{code}
As solution this issue I think what I can remove this variable from global 
scope and initialize it every time when call getMetric Identifier. But it is 
simple and most likely untrue solution.

> [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