Add opt-in support for metric overflow attribute#4737
Merged
utpilla merged 14 commits intoopen-telemetry:mainfrom Aug 9, 2023
Merged
Add opt-in support for metric overflow attribute#4737utpilla merged 14 commits intoopen-telemetry:mainfrom
utpilla merged 14 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4737 +/- ##
==========================================
+ Coverage 82.05% 82.08% +0.03%
==========================================
Files 313 313
Lines 12742 12784 +42
==========================================
+ Hits 10455 10494 +39
- Misses 2287 2290 +3
|
vishweshbankwar
approved these changes
Aug 3, 2023
Member
|
Need changelog and readme update (can be a separate PR) |
cijothomas
reviewed
Aug 3, 2023
test/OpenTelemetry.Tests/Metrics/MetricOverflowAttributeTests.cs
Outdated
Show resolved
Hide resolved
cijothomas
reviewed
Aug 3, 2023
cijothomas
reviewed
Aug 4, 2023
cijothomas
reviewed
Aug 4, 2023
cijothomas
reviewed
Aug 4, 2023
alanwest
reviewed
Aug 4, 2023
Member
alanwest
left a comment
There was a problem hiding this comment.
@utpilla I think this is a really interesting proposal! Are you considering proposing this in the specification? I think it might be a good "official" addition and enable us to remove the feature flag in the future.
Given this PR is also proposing a new way for us to feature flag experimental stuff... I have some thoughts about this AppContext mechanic.
…or-metrics-overflow-attribute
cijothomas
reviewed
Aug 7, 2023
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
alanwest
approved these changes
Aug 8, 2023
reyang
approved these changes
Aug 8, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add opt-in support for metric overflow attribute: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#overflow-attribute
For example:
If we have an SDK configuration where the max MetricPoint limit is four and the application emits the following measurements using a Counter:
As of today, the SDK would:
Therefore, we would only pick the first three unique measurements and drop (red, cherries) and (green, kiwi). Note that there is no way to know the total number of fruits sold as we have dropped the last two MetricPoints.
With the changes in this PR, the SDK would:
In this case, we would only pick the first two unique measurements, however we would not entirely drop the other three measurements. (green,apple), (red, cherries) and (green, kiwi) would all be aggregated using the new MetricPoint with the overflow attribute.
There are two advantages of doing this:
otel.metric.overflow: truewhen querying a metric indicates that the SDK could not aggregate some number of measurements under their own MetricPoint. As of today, one would have to check the SDK internal logs for this information.Changes
metric.overflow.attributeto record metric points that are emitted after the max MetricPoints limit is reached. One MetricPoint in the MetricPoint array would be reserved for this.OTEL_DOTNET_EXPERIMENTAL_METRICS_EMIT_OVERFLOW_ATTRIBUTEtotrueMetricAPITests,MetricSnapshotTests, andAggregatorTeststo also run with this behavior enabledPlease provide a brief description of the changes here.
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes