From c7e39e6513179a54a5921a0cd7dd5356d35462f1 Mon Sep 17 00:00:00 2001 From: Leonid Vinogradov Date: Thu, 14 Nov 2024 17:39:17 +0300 Subject: [PATCH] HH-237726 fix otel span name --- frontik/request_integrations/telemetry.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontik/request_integrations/telemetry.py b/frontik/request_integrations/telemetry.py index bbadd60d7..afedd927f 100644 --- a/frontik/request_integrations/telemetry.py +++ b/frontik/request_integrations/telemetry.py @@ -46,6 +46,9 @@ def _start_span(tracer, tornado_request) -> trace.span.Span: def _get_default_span_name(tornado_request): + if (handler_name := request_context.get_handler_name()) is not None: + return handler_name + path = tornado_request.path method = tornado_request.method if method and path: @@ -95,7 +98,6 @@ def _finish_span(span, dto: IntegrationDto, tornado_request: HTTPServerRequest): span.set_attribute(SpanAttributes.HTTP_ROUTE, getattr(tornado_request, '_path_format')) if (handler_name := request_context.get_handler_name()) is not None: method_path, method_name = handler_name.rsplit('.', 1) - span.update_name(f'{method_path}.{method_name}') span.set_attribute(SpanAttributes.CODE_FUNCTION, method_name) span.set_attribute(SpanAttributes.CODE_NAMESPACE, method_path)