Skip to content

Explicit histogram boundaries do not match the otel spec #3669

@artdent

Description

@artdent

What happened?

Steps to Reproduce

Initialize sdk-metrics and create a histogram with the default settings. Observe the chosen histogram buckets.

Expected Result

The chosen boundaries should match the metrics spec:

The Default Value represents the following buckets (heavily influenced by the default buckets of Prometheus clients, e.g. Java and Go):
(-∞, 0], (0, 5.0], (5.0, 10.0], (10.0, 25.0], (25.0, 50.0], (50.0, 75.0], (75.0, 100.0], (100.0, 250.0], (250.0, 500.0], (500.0, 750.0], (750.0, 1000.0], (1000.0, 2500.0], (2500.0, 5000.0], (5000.0, 7500.0], (7500.0, 10000.0], (10000.0, +∞). SDKs SHOULD use the default value when boundaries are not explicitly provided, unless they have good reasons to use something different (e.g. for backward compatibility reasons in a stable SDK release).

Specifically, the default boundaries should be [0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000].

Actual Result

The default boundaries in the node metrics sdk instead are [0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000], which is not as useful for e.g. bucketing slow RPCs.

Additional Details

It looks like the defaults are configured here in the sdk-metrics package.

OpenTelemetry Setup Code

No response

package.json

{
  "dependencies": {
    "@opentelemetry/api": "1.3.0",
    "@opentelemetry/sdk-node": "0.34.0",
    "@opentelemetry/sdk-trace-base": "1.8.0",
  }
}

Relevant log output

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomerspriority:p4Bugs and spec inconsistencies which do not fall into a higher prioritizationspec-noncompliantAn existing feature incorrectly or incompletely implements the OTel spec. May or may not be a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions