diff --git a/CHANGELOG.md b/CHANGELOG.md index b3520bb124..0ffed3715f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `opentelemetry-instrumentation-fastapi`: fix wrapping of middlewares ([#3012](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3012)) +- `opentelemetry-instrumentation-falcon`: proper bucket boundaries in stable semconv http duration + ([#3525](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3525)) - `opentelemetry-instrumentation-wsgi`: add explicit http duration buckets for stable semconv ([#3527](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3527)) - `opentelemetry-instrumentation-asgi`: add explicit http duration buckets for stable semconv diff --git a/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py b/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py index 4891fbbcae..9c670287aa 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py @@ -196,6 +196,7 @@ def response_hook(span, req, resp): import opentelemetry.instrumentation.wsgi as otel_wsgi from opentelemetry import context, trace from opentelemetry.instrumentation._semconv import ( + HTTP_DURATION_HISTOGRAM_BUCKETS_NEW, _get_schema_url, _OpenTelemetrySemanticConventionStability, _OpenTelemetryStabilitySignalType, @@ -297,6 +298,7 @@ def __init__(self, *args, **kwargs): name=HTTP_SERVER_REQUEST_DURATION, description="Duration of HTTP server requests.", unit="s", + explicit_bucket_boundaries_advisory=HTTP_DURATION_HISTOGRAM_BUCKETS_NEW, ) self.active_requests_counter = self._otel_meter.create_up_down_counter( diff --git a/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py b/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py index 48cbdbe3f8..3c2e4caea4 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py +++ b/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py @@ -22,6 +22,7 @@ from opentelemetry import trace from opentelemetry.instrumentation._semconv import ( + HTTP_DURATION_HISTOGRAM_BUCKETS_NEW, OTEL_SEMCONV_STABILITY_OPT_IN, _OpenTelemetrySemanticConventionStability, _server_active_requests_count_attrs_new, @@ -550,6 +551,10 @@ def test_falcon_metric_values_new_semconv(self): self.assertAlmostEqual( duration, point.sum, delta=10 ) + self.assertEqual( + point.explicit_bounds, + HTTP_DURATION_HISTOGRAM_BUCKETS_NEW, + ) if isinstance(point, NumberDataPoint): self.assertEqual(point.value, 0) number_data_point_seen = True @@ -600,6 +605,11 @@ def test_falcon_metric_values_both_semconv(self): self.assertAlmostEqual( max(duration_s, 0), point.sum, delta=10 ) + self.assertEqual( + point.explicit_bounds, + HTTP_DURATION_HISTOGRAM_BUCKETS_NEW, + ) + histogram_data_point_seen = True if isinstance(point, NumberDataPoint): self.assertEqual(point.value, 0)