-
Notifications
You must be signed in to change notification settings - Fork 524
feat: Add and enabled Metric cardinality capping by default #2901
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
feat: Add and enabled Metric cardinality capping by default #2901
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2901 +/- ##
=======================================
+ Coverage 81.0% 81.3% +0.2%
=======================================
Files 125 125
Lines 23945 24132 +187
=======================================
+ Hits 19414 19628 +214
+ Misses 4531 4504 -27 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
let AggregateFns { measure, collect } = match aggregate_fn(b, &agg, kind) { | ||
Ok(Some(inst)) => inst, | ||
other => return other.map(|fs| fs.map(|inst| inst.measure)), // Drop aggregator or error | ||
}; | ||
|
||
otel_debug!( | ||
name : "Metrics.InstrumentCreated", | ||
instrument_name = stream.name.as_ref(), |
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.
nit: Add Aggregation
information as well to understand what kind of instrument was created.
Fixes #1065
Re-introduce Metric cardinality capping, but this time, with the ability to configure the limit using Views.
The default is 2000, following OTel spec.
There is no ability to change the limit globally (at reader level) - this is not a MUST from the spec, and based on my experience, this is rarely used/needed.
Existing tests are re-enabled, and also enhanced to test customization ability and to test that limits are per cycle.
TODO (in next PR): is to add coverage for all instruments, as only Counters are currently covered.
TODO : doc additions. Depending on the next PR where I plan to introduce customization ability via Advisory, we can decide how best to document this.
TODO(next PR): Fix #2878 too
I expect to send another PR which will enhance the Instrument Advisory parameters to accept cardinality limits via that option. This is not a thing from the spec (but spec does not prohibit offering additional capabilities either), but planned to be added to Rust as using Views is generally non-trivial and my own experience tells it is somewhat confusing.
(Also planning to make a spec enhancement proposal in parallel, but I don't think it is a blocker)