Skip to content

Commit dc35754

Browse files
authored
opentelemetry-instrumentation-falcon: add explicit http duration buckets for stable semconv (#3525)
1 parent fa6d972 commit dc35754

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
- `opentelemetry-instrumentation-fastapi`: fix wrapping of middlewares
1717
([#3012](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3012))
18+
- `opentelemetry-instrumentation-falcon`: proper bucket boundaries in stable semconv http duration
19+
([#3525](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3525))
1820
- `opentelemetry-instrumentation-wsgi`: add explicit http duration buckets for stable semconv
1921
([#3527](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3527))
2022
- `opentelemetry-instrumentation-asgi`: add explicit http duration buckets for stable semconv

instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def response_hook(span, req, resp):
196196
import opentelemetry.instrumentation.wsgi as otel_wsgi
197197
from opentelemetry import context, trace
198198
from opentelemetry.instrumentation._semconv import (
199+
HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
199200
_get_schema_url,
200201
_OpenTelemetrySemanticConventionStability,
201202
_OpenTelemetryStabilitySignalType,
@@ -297,6 +298,7 @@ def __init__(self, *args, **kwargs):
297298
name=HTTP_SERVER_REQUEST_DURATION,
298299
description="Duration of HTTP server requests.",
299300
unit="s",
301+
explicit_bucket_boundaries_advisory=HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
300302
)
301303

302304
self.active_requests_counter = self._otel_meter.create_up_down_counter(

instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
from opentelemetry import trace
2424
from opentelemetry.instrumentation._semconv import (
25+
HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
2526
OTEL_SEMCONV_STABILITY_OPT_IN,
2627
_OpenTelemetrySemanticConventionStability,
2728
_server_active_requests_count_attrs_new,
@@ -550,6 +551,10 @@ def test_falcon_metric_values_new_semconv(self):
550551
self.assertAlmostEqual(
551552
duration, point.sum, delta=10
552553
)
554+
self.assertEqual(
555+
point.explicit_bounds,
556+
HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
557+
)
553558
if isinstance(point, NumberDataPoint):
554559
self.assertEqual(point.value, 0)
555560
number_data_point_seen = True
@@ -600,6 +605,11 @@ def test_falcon_metric_values_both_semconv(self):
600605
self.assertAlmostEqual(
601606
max(duration_s, 0), point.sum, delta=10
602607
)
608+
self.assertEqual(
609+
point.explicit_bounds,
610+
HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
611+
)
612+
603613
histogram_data_point_seen = True
604614
if isinstance(point, NumberDataPoint):
605615
self.assertEqual(point.value, 0)

0 commit comments

Comments
 (0)