-
Notifications
You must be signed in to change notification settings - Fork 513
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
example: add temporality selector option to metrics-basic #2217
example: add temporality selector option to metrics-basic #2217
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2217 +/- ##
=======================================
+ Coverage 79.2% 79.3% +0.1%
=======================================
Files 122 121 -1
Lines 20986 20944 -42
=======================================
- Hits 16623 16612 -11
+ Misses 4363 4332 -31 ☔ View full report in Codecov by Sentry. |
23494fc
to
773803c
Compare
Used the full path so it can just be uncommented without needing to adjust imports
4561323
to
2fcb26a
Compare
c8e1fa1
to
2e6a0af
Compare
2e6a0af
to
a7210f6
Compare
@@ -945,7 +944,11 @@ mod tests { | |||
|
|||
assert_eq!(sum.data_points.len(), 1, "Expected only one data point"); | |||
assert!(!sum.is_monotonic, "Should not produce monotonic."); | |||
assert_eq!(sum.temporality, Temporality::Delta, "Should produce Delta"); | |||
assert_eq!( |
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.
Rename this test method to no_attr_up_down_counter
now that its behavior has changed.
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 updated to no_attr_up_down_counter_always_cumulative
, and updated the assertion reason to indicate why Cumulative
would be selected when Delta
is provided for clarity in the future.
opentelemetry-otlp/src/lib.rs
Outdated
@@ -183,7 +183,7 @@ | |||
//! .with_resource(Resource::new(vec![KeyValue::new("service.name", "example")])) | |||
//! .with_period(Duration::from_secs(3)) | |||
//! .with_timeout(Duration::from_secs(10)) | |||
//! .with_temporality_selector(DefaultTemporalitySelector::new()) | |||
//! .with_temporality(Temporality::default()) |
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.
Following the same thing as #2217 (comment), we could just remove this.
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.
Looks good overall!
The public APIs exposed on MetricReader
and PushMetricExporter
traits might be updated in the future. That's mainly because it could be beneficial to push the "temporality + instrument kind" configuration solely to the exporter. That discussion and decision can happen independent of this PR.
Awesome! I would be happy to take part in the discussion and decision around this topic when it comes up, I have been enjoying contributing to this code base and would like to take part more often :) I will also update the CHANGELOG now that the larger concerns were addressed |
Thanks!
AddFooExporter() is offered by vendors/exporter authors which will add the right metric_reader with correct temporality etc automatically. Of course this is not a requirement, so users can add reader themselves. Alternatively, these traits can be provided with default implementation, so exporters need to override only if they wish to. Closely related to that is the below issue. I am not a fan of OTLPExporter exposing duplicate concepts as that of SDK, so this could use some cleanups. @pitoniak32 If you are up for it, please take a look at the above! Very happy to see more contributions from you. |
For sure! I will take a look at this one after work today |
Follow up PR from this comment: #2204 (review)
Changes
Add Temporality selector option to metrics-basic example
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes