Skip to content

Commit d1c747e

Browse files
committed
Change http.target to SpanAttributes.HTTP_TARGET
1 parent 7d3c150 commit d1c747e

File tree

1 file changed

+3
-6
lines changed
  • instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask

1 file changed

+3
-6
lines changed

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,12 @@ def response_hook(span: Span, status: str, response_headers: List):
266266
)
267267
from opentelemetry.instrumentation.utils import _start_internal_or_server_span
268268
from opentelemetry.metrics import get_meter
269-
from opentelemetry.semconv._incubating.attributes.http_attributes import (
270-
HTTP_TARGET,
271-
)
272269
from opentelemetry.semconv.attributes.http_attributes import HTTP_ROUTE
273270
from opentelemetry.semconv.metrics import MetricInstruments
274271
from opentelemetry.semconv.metrics.http_metrics import (
275272
HTTP_SERVER_REQUEST_DURATION,
276273
)
274+
from opentelemetry.semconv.trace import SpanAttributes
277275
from opentelemetry.util.http import (
278276
get_excluded_urls,
279277
parse_excluded_urls,
@@ -399,10 +397,9 @@ def _start_response(status, response_headers, *args, **kwargs):
399397
)
400398

401399
if wrapped_app_environ.get(_ENVIRON_REQUEST_ROUTE_KEY, None):
402-
duration_attrs_old[HTTP_TARGET] = wrapped_app_environ.get(
403-
_ENVIRON_REQUEST_ROUTE_KEY
400+
duration_attrs_old[SpanAttributes.HTTP_TARGET] = (
401+
wrapped_app_environ.get(_ENVIRON_REQUEST_ROUTE_KEY)
404402
)
405-
406403
duration_histogram_old.record(
407404
max(round(duration_s * 1000), 0), duration_attrs_old
408405
)

0 commit comments

Comments
 (0)