From d1c747ef9d5e6b78a7d4c9126614a336fc73ef77 Mon Sep 17 00:00:00 2001 From: GonzaloGuasch Date: Thu, 18 Jul 2024 13:04:18 -0300 Subject: [PATCH] Change http.target to SpanAttributes.HTTP_TARGET --- .../src/opentelemetry/instrumentation/flask/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py b/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py index ddd8065a2b..f008ae11f0 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py @@ -266,14 +266,12 @@ def response_hook(span: Span, status: str, response_headers: List): ) from opentelemetry.instrumentation.utils import _start_internal_or_server_span from opentelemetry.metrics import get_meter -from opentelemetry.semconv._incubating.attributes.http_attributes import ( - HTTP_TARGET, -) from opentelemetry.semconv.attributes.http_attributes import HTTP_ROUTE from opentelemetry.semconv.metrics import MetricInstruments from opentelemetry.semconv.metrics.http_metrics import ( HTTP_SERVER_REQUEST_DURATION, ) +from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.util.http import ( get_excluded_urls, parse_excluded_urls, @@ -399,10 +397,9 @@ def _start_response(status, response_headers, *args, **kwargs): ) if wrapped_app_environ.get(_ENVIRON_REQUEST_ROUTE_KEY, None): - duration_attrs_old[HTTP_TARGET] = wrapped_app_environ.get( - _ENVIRON_REQUEST_ROUTE_KEY + duration_attrs_old[SpanAttributes.HTTP_TARGET] = ( + wrapped_app_environ.get(_ENVIRON_REQUEST_ROUTE_KEY) ) - duration_histogram_old.record( max(round(duration_s * 1000), 0), duration_attrs_old )