Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-django`: proper bucket boundaries in stable semconv http duration
([#3523](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3523))

### Breaking changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def response_hook(span, request, response):
from django.core.exceptions import ImproperlyConfigured

from opentelemetry.instrumentation._semconv import (
HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
_get_schema_url,
_OpenTelemetrySemanticConventionStability,
_OpenTelemetryStabilitySignalType,
Expand Down Expand Up @@ -378,6 +379,7 @@ def _instrument(self, **kwargs):
name=HTTP_SERVER_REQUEST_DURATION,
description="Duration of HTTP server requests.",
unit="s",
explicit_bucket_boundaries_advisory=HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
)
_DjangoMiddleware._active_request_counter = (
create_http_server_active_requests(meter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

from opentelemetry import trace
from opentelemetry.instrumentation._semconv import (
HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
HTTP_DURATION_HISTOGRAM_BUCKETS_OLD,
OTEL_SEMCONV_STABILITY_OPT_IN,
_OpenTelemetrySemanticConventionStability,
)
Expand Down Expand Up @@ -814,6 +816,10 @@ def test_wsgi_metrics_new_semconv(self):
expected_duration_attributes,
dict(point.attributes),
)
self.assertEqual(
point.explicit_bounds,
HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
)
if isinstance(point, NumberDataPoint):
number_data_point_seen = True
self.assertEqual(point.value, 0)
Expand Down Expand Up @@ -886,6 +892,10 @@ def test_wsgi_metrics_both_semconv(self):
expected_duration_attributes_new,
dict(point.attributes),
)
self.assertEqual(
point.explicit_bounds,
HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
)
elif metric.name == "http.server.duration":
self.assertAlmostEqual(
duration, point.sum, delta=100
Expand All @@ -894,6 +904,10 @@ def test_wsgi_metrics_both_semconv(self):
expected_duration_attributes_old,
dict(point.attributes),
)
self.assertEqual(
point.explicit_bounds,
HTTP_DURATION_HISTOGRAM_BUCKETS_OLD,
)
if isinstance(point, NumberDataPoint):
number_data_point_seen = True
self.assertEqual(point.value, 0)
Expand Down
Loading