open-telemetry / open-telemetry/opentelemetry-java-instrumentation

Allow overriding http.(client/server).request.duration buckets via environment variables to control cardinality

Open
#18,338 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs triage
Dominant language
Java
Stars
2.6k
Forks
1.2k
Avg merge
2d 18h
Merged PRs (30d)
228

Description

Is your feature request related to a problem? Please describe.

By default, the http.(client/server).request.duration metrics has 14 defined buckets, as specified in the SemConv for this metric. While this is correct, it would be really useful if it were possible to define the buckets via an environment variable to reduce cardinality in our metrics.
This would allow us to continue using the java-agent.jar out-of-the-box without having to add any additional programmatic configuration. By supporting environment variables, we can maintain a purely declarative setup, which is more infrastructure-as-code friendly and avoids the need for custom SDK extensions or manual code changes.

Describe the solution you'd like

I would like to see a new configuration option, for example, an environment variable like OTEL_HTTP_METRICS_BUCKETS that allows users to provide a comma-separated list of values

Describe alternatives you've considered

No response

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the HTTP client and server request.duration instrumentation, its bucket configuration, and existing environment-variable parsing tests. Verify how a comma-separated OTEL_HTTP_METRICS_BUCKETS value should be interpreted, then add coverage for both instrumentations and confirm that the configured buckets replace the defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.