-
Notifications
You must be signed in to change notification settings - Fork 772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor refactor MetricReader and AggregationTemporality #2357
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2357 +/- ##
==========================================
- Coverage 80.96% 80.95% -0.02%
==========================================
Files 229 229
Lines 7318 7323 +5
==========================================
+ Hits 5925 5928 +3
- Misses 1393 1395 +2
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dropped some comments but nothing blocking.
@@ -32,7 +32,7 @@ namespace OpenTelemetry.Exporter | |||
/// Exporter consuming <see cref="Metric"/> and exporting the data using | |||
/// the OpenTelemetry protocol (OTLP). | |||
/// </summary> | |||
[AggregationTemporality(AggregationTemporality.Both, AggregationTemporality.Cumulative)] | |||
[AggregationTemporality(AggregationTemporality.Cumulative | AggregationTemporality.Delta, AggregationTemporality.Cumulative)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR, but I'm not following why the OTLP exporter is marked to prefer Cumulative
. Seems to me the OTLP exporter should effectively not have a preference.
For a given service, is it currently not possible for some metrics to have a cumulative aggregation and others to have a delta aggregation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, sorry, I think this is making sense to me now. I'm still trying to keep all these things in my head. I continue going back to a time when there was discussion about being able to define aggregation temporality at the level of an individual instrument or view. This is not the case.
Aggregation temporality is essentially defined at the level of a pipeline - so like MetricReader
-> MetricExporter
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me put some concrete examples to help us align the understanding:
Prometheus - only supports Cumulative (implied that Cumulative is also the preference):
- The user doesn't have to specify temporality during the SDK configuration, everything will be exported as cumulative. In case the measurement being reported is Delta, there will be Delta->Cumulative conversion.
- If the user specified Cumulative explicitly, it won't harm
- If the user specified Delta explicitly, they will get some error telling them that the setup is wrong.
OTLP - supports both Cumulative and Delta (and Cumulative is the preference):
- The user doesn't have to specify temporality during the SDK configuration, everything will be exported as Cumulative. In case the measurement being reported is Delta, there will be Delta->Cumulative conversion.
- If the user specified Cumulative explicitly, it won't harm
- If the user specified Delta explicitly, there are two cases:
- If the value being reported is Delta (e.g. Counter), it'll be reported as Delta, no conversion required
- If the value being reported is Cumulative (e.g. ObservableCounter), there will be Cumulative->Delta conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this context! Defaulting to cumulative had seemed somewhat arbitrary to me, but Prometheus + load-balanced collectors = a bad time if delta. Prometheus seems to make everything trickier 😄.
Trying to address the review comments / suggestions from @CodeBlanch.
Fixes #2355.