Skip to content

Add with_boundaries hint API for explicit bucket histograms#2135

Merged
cijothomas merged 5 commits intoopen-telemetry:mainfrom
utpilla:utpilla/Add-Hint-API-For-Histogram
Sep 24, 2024
Merged

Add with_boundaries hint API for explicit bucket histograms#2135
cijothomas merged 5 commits intoopen-telemetry:mainfrom
utpilla:utpilla/Add-Hint-API-For-Histogram

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)

@codecov
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
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
@utpilla utpilla mentioned this pull request Sep 25, 2024
4 tasks
takumi-earth pushed a commit to earthlings-dev/opentelemetry-rust that referenced this pull request Jan 27, 2026
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