Skip to content

Commit 93daa35

Browse files
committed
Change http.route to SpanAttributes.HTTP_ROUTE
1 parent 547c99c commit 93daa35

File tree

1 file changed

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

1 file changed

+3
-4
lines changed

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ 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.attributes.http_attributes import HTTP_ROUTE
270269
from opentelemetry.semconv.metrics import MetricInstruments
271270
from opentelemetry.semconv.metrics.http_metrics import (
272271
HTTP_SERVER_REQUEST_DURATION,
@@ -409,8 +408,8 @@ def _start_response(status, response_headers, *args, **kwargs):
409408
)
410409

411410
if wrapped_app_environ.get(_ENVIRON_REQUEST_ROUTE_KEY, None):
412-
duration_attrs_new[HTTP_ROUTE] = wrapped_app_environ.get(
413-
_ENVIRON_REQUEST_ROUTE_KEY
411+
duration_attrs_new[SpanAttributes.HTTP_ROUTE] = (
412+
wrapped_app_environ.get(_ENVIRON_REQUEST_ROUTE_KEY)
414413
)
415414

416415
duration_histogram_new.record(
@@ -443,7 +442,7 @@ def _before_request():
443442
if flask.request.url_rule:
444443
# For 404 that result from no route found, etc, we
445444
# don't have a url_rule.
446-
attributes[HTTP_ROUTE] = flask.request.url_rule.rule
445+
attributes[SpanAttributes.HTTP_ROUTE] = flask.request.url_rule.rule
447446
span, token = _start_internal_or_server_span(
448447
tracer=tracer,
449448
span_name=span_name,

0 commit comments

Comments
 (0)