Skip to content

Commit

Permalink
Change http.target to SpanAttributes.HTTP_TARGET
Browse files Browse the repository at this point in the history
  • Loading branch information
GonzaloGuasch committed Jul 18, 2024
1 parent 7d3c150 commit d1c747e
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
)
Expand Down

0 comments on commit d1c747e

Please sign in to comment.