Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
ERROR_TYPE,
)
from opentelemetry.semconv._incubating.attributes.http_attributes import (
HTTP_RESPONSE_STATUS_CODE,
HTTP_STATUS_CODE,
)
from opentelemetry.semconv.attributes.http_attributes import HTTP_ROUTE
Expand Down Expand Up @@ -265,9 +266,8 @@ def trace_tween(request):
status = getattr(response, "status", status)
status_code = otel_wsgi._parse_status_code(status)
if status_code is not None:
duration_attrs[HTTP_STATUS_CODE] = (
otel_wsgi._parse_status_code(status)
)
duration_attrs[HTTP_STATUS_CODE] = status_code
duration_attrs[HTTP_RESPONSE_STATUS_CODE] = status_code

# Record metrics for old semconv (milliseconds)
if duration_histogram_old:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ def _verify_metric_names(

def _verify_duration_point(self, point):
self.assertIn(HTTP_REQUEST_METHOD, point.attributes)
self.assertIn(HTTP_RESPONSE_STATUS_CODE, point.attributes)
self.assertIn(URL_SCHEME, point.attributes)
self.assertNotIn(HTTP_METHOD, point.attributes)
self.assertNotIn(HTTP_SCHEME, point.attributes)
Expand Down