Skip to content

Commit b088bcb

Browse files
committed
refactor(fastapi): migrate HTTP_ROUTE from SpanAttributes to new semantic conventions
Replaced usage of `SpanAttributes.HTTP_ROUTE` with `opentelemetry.semconv.attributes.http_attributes.HTTP_ROUTE` as part of the migration away from `SpanAttributes`. Refs: open-telemetry#3475
1 parent 4a1e0ce commit b088bcb

File tree

1 file changed

+2
-2
lines changed
  • instrumentation/opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def client_response_hook(span: Span, scope: dict[str, Any], message: dict[str, A
204204
from opentelemetry.instrumentation.fastapi.version import __version__
205205
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
206206
from opentelemetry.metrics import get_meter
207-
from opentelemetry.semconv.trace import SpanAttributes
207+
from opentelemetry.semconv.attributes.http_attributes import HTTP_ROUTE
208208
from opentelemetry.trace import get_tracer
209209
from opentelemetry.util.http import (
210210
get_excluded_urls,
@@ -450,7 +450,7 @@ def _get_default_span_details(scope):
450450
if method == "_OTHER":
451451
method = "HTTP"
452452
if route:
453-
attributes[SpanAttributes.HTTP_ROUTE] = route
453+
attributes[HTTP_ROUTE] = route
454454
if method and route: # http
455455
span_name = f"{method} {route}"
456456
elif route: # websocket

0 commit comments

Comments
 (0)