You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Chesnay Schepler (Jira)" <ji...@apache.org> on 2020/10/30 13:19:00 UTC

[jira] [Updated] (FLINK-19901) Unable to exclude metrics variables for the last metrics reporter.

     [ https://issues.apache.org/jira/browse/FLINK-19901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chesnay Schepler updated FLINK-19901:
-------------------------------------
    Fix Version/s: 1.11.3
                   1.10.3
                   1.12.0

> Unable to exclude metrics variables for the last metrics reporter.
> ------------------------------------------------------------------
>
>                 Key: FLINK-19901
>                 URL: https://issues.apache.org/jira/browse/FLINK-19901
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Metrics
>    Affects Versions: 1.10.0
>            Reporter: Truong Duc Kien
>            Assignee: Chesnay Schepler
>            Priority: Major
>             Fix For: 1.12.0, 1.10.3, 1.11.3
>
>
> We discovered a bug that leads to the setting {{scope.variables.excludes}} being ignored for the very last metric reporter.
> Because {{reporterIndex}} was incremented before the length check, the last metrics reporter setting is overflowed back to 0.
> Interestingly, this bug does not trigger when there's only one metric reporter, because slot 0 is actually overwritten with that reporter's variables instead of being used to store all variables in that case.
> {code:java}
> public abstract class AbstractMetricGroup<A extends AbstractMetricGroup<?>> implements MetricGroup {
> ...
> 	public Map<String, String> getAllVariables(int reporterIndex, Set<String> excludedVariables) {
> 		// offset cache location to account for general cache at position 0
> 		reporterIndex += 1;
> 		if (reporterIndex < 0 || reporterIndex >= logicalScopeStrings.length) {
> 			reporterIndex = 0;
> 		}
> 		// if no variables are excluded (which is the default!) we re-use the general variables map to save space
> 		return internalGetAllVariables(excludedVariables.isEmpty() ? 0 : reporterIndex, excludedVariables);
> 	}
> ...
> {code}
>  [Github link to the above code|https://github.com/apache/flink/blob/3bf5786655c3bb914ce02ebb0e4a1863b205b829/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java#L122]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)