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

Lukasz Gajowy commented on BEAM-6022:
-------------------------------------

[[email protected]]: I used Dataflow and Direct runners for this. 

An example of how this is being called is in the link (comment above). 

I think Scott clearly showed me what my problem was. I expected that I still 
should get one result even despite the fact that I'm writing the counter from 
different PTransforms. It isn't the case so I just need to query this 
differently depending on what I want to measure. 

Thank you for the explanation. Closing the issue (Not A Bug).

 

> Metrics of the same name and type are created multiple times
> ------------------------------------------------------------
>
>                 Key: BEAM-6022
>                 URL: https://issues.apache.org/jira/browse/BEAM-6022
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Lukasz Gajowy
>            Assignee: Kenneth Knowles
>            Priority: Major
>
> I noticed that when the below (or any other metric type) is called multiple 
> times:
> {code:java}
> Metrics.counter("namespace", "name");{code}
> metrics of the same name and type are created. So when such metrics are 
> queried by name:
> {code:java}
> MetricQueryResults metrics =
>     result
>         .metrics()
>         .queryMetrics(
>             MetricsFilter.builder()
>                 .addNameFilter(MetricNameFilter.named(namespace, name))
>                 .build());
> Iterable<MetricResult<Long>> counters = metrics.getCounters();{code}
> there is ambiguity which MetricResult should be chosen. 
> Should api users obtain one metric result here?
> Should api users  merge the counter results if there are multiple returned?
> I noticed that all of the results contain the same value (not sure if this is 
> always the case). Should api users read only one of the multiple results to 
> get correct metric?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to