Skip to content

Use correct bucket boundaries for otelgrpc client and server histograms#8642

Merged
dmathieu merged 2 commits into
open-telemetry:mainfrom
dashpole:grpc_buckets
Mar 6, 2026
Merged

Use correct bucket boundaries for otelgrpc client and server histograms#8642
dmathieu merged 2 commits into
open-telemetry:mainfrom
dashpole:grpc_buckets

Conversation

@dashpole
Copy link
Copy Markdown
Contributor

@dashpole dashpole commented Mar 5, 2026

Fixes #8638

It follows:

This metric SHOULD be specified with ExplicitBucketBoundaries of [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ].

The issue was introduced in #8481, where the unit changed from ms to s and we didn't catch it.

This impacts the v1.40.0 and v1.41.0 releases.

It is hard to unit test histogram bucket boundaries because metricdatatest.IgnoreValue() also ignores the bucket boundaries. It seems like we could make IgnoreValue not ignore histogram buckets (since those are constant), but that would probably break a lot of existing tests. We don't test bucket boundaries for otelhttp either.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.2%. Comparing base (b018d98) to head (fcf2bb9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8642   +/-   ##
=====================================
  Coverage   82.1%   82.2%           
=====================================
  Files        182     182           
  Lines      13754   13766   +12     
=====================================
+ Hits       11304   11316   +12     
  Misses      2048    2048           
  Partials     402     402           
Files with missing lines Coverage Δ
...n/google.golang.org/grpc/otelgrpc/stats_handler.go 98.4% <100.0%> (+<0.1%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmathieu
Copy link
Copy Markdown
Member

dmathieu commented Mar 6, 2026

Merging this without the wait for 24h so we can get this into the upcoming release.

@dmathieu dmathieu merged commit e70fd97 into open-telemetry:main Mar 6, 2026
29 checks passed
@dashpole dashpole deleted the grpc_buckets branch March 6, 2026 15:07
pellared added a commit that referenced this pull request Mar 6, 2026
#8649)

### Added

- Add environment variables propagation carrier in `go.opentelemetry.io/contrib/propagators/envcar`. (#8442)

### Changed

- Upgrade `go.opentelemetry.io/otel/semconv` to `v1.40.0`, including updates across instrumentation and detector modules. (#8631)
  - The semantic conventions v1.40.0 release introduces RPC breaking changes applied in this repository:
    - RPC spans and metrics no longer include `network.protocol.name`, `network.protocol.version`, or `network.transport` attributes.
    - `rpc.client.request.size`, `rpc.client.response.size`, `rpc.server.request.size`, and `rpc.server.response.size` are no longer emitted in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc`.
    - `rpc.message` span events and their message attributes are no longer emitted in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc` (including when `WithMessageEvents` is configured).

  See [semantic-conventions v1.40.0 release](https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.40.0) for complete details.

### Fixed

- Ignore informational response status codes (`100-199`) except `101 Switching Protocols` when storing the HTTP status code in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` and `go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux`. (#6913)
- Make `Body` handling in `Transport` consistent with stdlib in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp`. (#8618)
- Fix bucket boundaries for `rpc.server.call.duration` and `rpc.client.call.duration` in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc`. (#8642)
- Host resource detector in `go.opentelemetry.io/contrib/otelconf` now includes `os.` attributes. (#8578)

### Removed

- Drop support for [Go 1.24]. (#8628)

[Go 1.24]: https://go.dev/doc/go1.24
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.

[Bug]: otelgrpc server and client call.duration metrics do not have ExplicitBucketBoundaries specified as per somconv

3 participants