Clarification around the relationship between metric views and metric streams #3829
Labels
[label deprecated] triaged-accepted
[label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PR
spec:metrics
Related to the specification/metrics directory
What are you trying to achieve?
Opening this as a follow up on #2356 which was closed a while ago. I think the measurement processing part of the spec has not been changed since then so this still applies.
To folks not familiar with all parts of the spec or existing implementations, I believe the current measurement processing logic as explained in the spec does not make it clear that multiple streams will be generated if multiple views are matching the same instrument, potentially generating conflicts. As @jack-berg explained in the original issue, this is more confusing when the stream configuration of two or more metric views set different stream properties (e.g. one setting aggregation and the other attribute keys), which could lead end-users to incorrectly expect these to be "merged". The action of creating different streams per view seems to be implied by the following sentence:
I think this could be phrased better to explain that each view will create one or many streams, and those may result in conflicting metric identities. Furthermore, the examples in the section below don't seem to align with the spec. For instance, this one:
Seems to imply that these views will generate 3 streams:
X
with default attributes andSum
aggregationY
with attribute keysa
andb
and default aggregationZ
with attribute keysa
andb
and default aggregationIn reality, these views would generate a conflict on
X
, as it generates two different conflicting streams with the same name. In the case of Java, currently,X
would result in the relevant warning message and two metric streams:Sum
aggregation.a
andb
attributes and default aggregation.Making it clear that views generate different streams, and how conflicts are resolved at that level, could also help explain the special behaviour of the
drop
aggregation, which can be combined with other views matching the same instrument safely, as it cannot result in conflicts. This could be covered by an example.What did you expect to see?
I can work on a PR to add these if agreed.
The text was updated successfully, but these errors were encountered: