@@ -214,13 +214,11 @@ def response_hook(span, req, resp):
214214 extract_attributes_from_object ,
215215)
216216from opentelemetry .metrics import get_meter
217- from opentelemetry .semconv .attributes .error_attributes import ERROR_TYPE
218217from opentelemetry .semconv .metrics import MetricInstruments
219218from opentelemetry .semconv .metrics .http_metrics import (
220219 HTTP_SERVER_REQUEST_DURATION ,
221220)
222221from opentelemetry .semconv .trace import SpanAttributes
223- from opentelemetry .trace .status import StatusCode
224222from opentelemetry .util .http import get_excluded_urls , get_traced_request_attrs
225223
226224_logger = getLogger (__name__ )
@@ -255,7 +253,6 @@ class _InstrumentedFalconAPI(getattr(falcon, _instrument_app)):
255253 def __init__ (self , * args , ** kwargs ):
256254 otel_opts = kwargs .pop ("_otel_opts" , {})
257255
258- _OpenTelemetrySemanticConventionStability ._initialize ()
259256 self ._sem_conv_opt_in_mode = _OpenTelemetrySemanticConventionStability ._get_opentelemetry_stability_opt_in_mode (
260257 _OpenTelemetryStabilitySignalType .HTTP ,
261258 )
@@ -416,27 +413,13 @@ def _start_response(status, response_headers, *args, **kwargs):
416413 duration_attrs = otel_wsgi ._parse_duration_attrs (
417414 attributes , _HTTPStabilityMode .DEFAULT
418415 )
419- if span .is_recording ():
420- duration_attrs [SpanAttributes .HTTP_STATUS_CODE ] = (
421- span .attributes .get (SpanAttributes .HTTP_STATUS_CODE )
422- )
423416 self .duration_histogram_old .record (
424417 max (round (duration_s * 1000 ), 0 ), duration_attrs
425418 )
426419 if self .duration_histogram_new :
427420 duration_attrs = otel_wsgi ._parse_duration_attrs (
428421 attributes , _HTTPStabilityMode .HTTP
429422 )
430- if span .is_recording ():
431- duration_attrs [
432- SpanAttributes .HTTP_RESPONSE_STATUS_CODE
433- ] = span .attributes .get (
434- SpanAttributes .HTTP_RESPONSE_STATUS_CODE
435- )
436- if span .status .status_code == StatusCode .ERROR :
437- duration_attrs [ERROR_TYPE ] = span .attributes .get (
438- ERROR_TYPE
439- )
440423 self .duration_histogram_new .record (
441424 max (duration_s , 0 ), duration_attrs
442425 )
0 commit comments