Repository navigation
Description
Description
otel.sdk.exporter.operation.duration and otel.sdk.metric_reader.collection.duration are created via create_otel_sdk_exporter_operation_duration and create_otel_sdk_metric_reader_collection_duration without explicit_bucket_boundaries_advisory=[]:
Line 113 in 66ec883
self._duration = create_otel_sdk_exporter_operation_duration(meter) Line 40 in 66ec883
self._collection_duration = create_otel_sdk_metric_reader_collection_duration(meter) Lines 107 to 113 in 66ec883
def create_otel_sdk_exporter_operation_duration(meter: Meter) -> Histogram: """The duration of exporting a batch of telemetry records""" return meter.create_histogram( name=OTEL_SDK_EXPORTER_OPERATION_DURATION, description="The duration of exporting a batch of telemetry records.", unit="s", ) Lines 220 to 226 in 66ec883
def create_otel_sdk_metric_reader_collection_duration(meter: Meter) -> Histogram: """The duration of the collect operation of the metric reader""" return meter.create_histogram( name=OTEL_SDK_METRIC_READER_COLLECTION_DURATION, description="The duration of the collect operation of the metric reader.", unit="s", )
Per the SDK self-observability specification for otel.sdk.exporter.operation.duration and otel.sdk.metric_reader.collection.duration, both histograms SHOULD be specified with the ExplicitBucketBoundaries advisory parameter with a single bucket with no boundaries (explicit_bucket_boundaries_advisory=[]). Without this advisory, the SDK applies the default millisecond bucket boundaries ((0.0, 5.0, 10.0, ..., 10000.0)) to metrics measured in seconds (s).
Expected behavior
Both otel.sdk.exporter.operation.duration and otel.sdk.metric_reader.collection.duration should pass explicit_bucket_boundaries_advisory=[] to meter.create_histogram().
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
ImamWahyudiz commentedon Nov 6, 2026
Hi @dashpole, I would like to work on this and add the explicit bucket boundaries advisory to the duration histograms.
dashpole commentedon Nov 6, 2026
Sounds good, feel free to open a PR! Note that opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/otel_metrics.py is generated from scripts/semconv/templates/registry/semantic_metrics.j2, so my suggestion would be to add an optional explicit_bucket_boundaries_advisory parameter to the histogram template (or call meter.create_histogram directly in _exporter_metrics.py and _metric_reader_metrics.py) rather than hand-editing otel_metrics.py.
ImamWahyudiz commentedon Nov 7, 2026
Thanks for the pointer, @dashpole! I've opened PR #5895 and updated _exporter_metrics.py and _metric_reader_metrics.py to call meter.create_histogram directly with explicit_bucket_boundaries_advisory=[], keeping otel_metrics.py untouched.