Skip to content
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 with_boundaries hint API for explicit bucket histograms #2135

Merged

Conversation

utpilla
Copy link
Contributor

@utpilla utpilla commented Sep 21, 2024

Related to #1241

Changes

  • Add with_boundaries hint API for explicit bucket histograms

Usage

let histogram = meter
        .f64_histogram("my_histogram")
        .with_description("My histogram example description")
+       .with_boundaries(vec![1.0, 2.0, 3.0, 4.0, 5.0])
        .init();

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

Copy link

codecov bot commented Sep 21, 2024

Codecov Report

Attention: Patch coverage is 96.42857% with 3 lines in your changes missing coverage. Please review.

Project coverage is 79.0%. Comparing base (b244673) to head (eb81dd3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-sdk/src/metrics/mod.rs 95.0% 2 Missing ⚠️
opentelemetry/src/metrics/instruments/mod.rs 83.3% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2135   +/-   ##
=====================================
  Coverage   78.9%   79.0%           
=====================================
  Files        121     121           
  Lines      20831   20908   +77     
=====================================
+ Hits       16453   16527   +74     
- Misses      4378    4381    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@utpilla utpilla marked this pull request as ready for review September 24, 2024 04:10
@utpilla utpilla requested a review from a team as a code owner September 24, 2024 04:10
@@ -72,6 +76,12 @@ impl<'a, T> HistogramBuilder<'a, T> {
self.unit = Some(unit.into());
self
}

/// Set the boundaries for this histogram.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Setting boundaries is optional. By default, the boundaries are set to
// [0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, 750.0, 1000.0, 2500.0, 5000.0, 7500.0, 10000.0]

please copy this wording too.

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
This was probably the last blocker, and now we can upgrade opentelemetry metrics api as beta.

@cijothomas
Copy link
Member

Co-incidentally, OTel .NET just did the same feature addition at same time as OTel Rust!
https://github.com/open-telemetry/opentelemetry-dotnet/pull/5854/files

@cijothomas cijothomas merged commit c8136d9 into open-telemetry:main Sep 24, 2024
25 checks passed
@utpilla utpilla mentioned this pull request Sep 25, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants