-
Notifications
You must be signed in to change notification settings - Fork 773
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
Add opt-in support for metric overflow attribute #4737
Add opt-in support for metric overflow attribute #4737
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
|
Need changelog and readme update (can be a separate PR) |
test/OpenTelemetry.Tests/Metrics/MetricOverflowAttributeTests.cs
Outdated
Show resolved
Hide resolved
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.
@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
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
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: true
when 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.attribute
to 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_ATTRIBUTE
totrue
MetricAPITests
,MetricSnapshotTests
, andAggregatorTests
to also run with this behavior enabledPlease provide a brief description of the changes here.
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes