From 8594770f3b3f4eb2599c37c5a15d44bcc841bce4 Mon Sep 17 00:00:00 2001 From: Varsha GS Date: Thu, 13 Feb 2025 13:00:55 +0530 Subject: [PATCH] fix: remove unsupported span attribute Signed-off-by: Varsha GS --- src/instana/instrumentation/asgi.py | 1 - src/instana/instrumentation/pep0249.py | 2 -- src/instana/instrumentation/pyramid.py | 1 - src/instana/instrumentation/sanic_inst.py | 1 - src/instana/span/registered_span.py | 4 ++-- tests/clients/test_pep0249.py | 1 - tests/span/test_registered_span.py | 1 - 7 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/instana/instrumentation/asgi.py b/src/instana/instrumentation/asgi.py index 2831bb92..775c4f50 100644 --- a/src/instana/instrumentation/asgi.py +++ b/src/instana/instrumentation/asgi.py @@ -31,7 +31,6 @@ def __init__(self, app: "ExceptionMiddleware") -> None: def _collect_kvs(self, scope: Dict[str, Any], span: "InstanaSpan") -> None: try: - span.set_attribute("span.kind", SpanKind.SERVER) span.set_attribute("http.path", scope.get("path")) span.set_attribute(SpanAttributes.HTTP_METHOD, scope.get("method")) diff --git a/src/instana/instrumentation/pep0249.py b/src/instana/instrumentation/pep0249.py index a6ad5642..1108433b 100644 --- a/src/instana/instrumentation/pep0249.py +++ b/src/instana/instrumentation/pep0249.py @@ -38,8 +38,6 @@ def _collect_kvs( sql: str, ) -> None: try: - span.set_attribute("span.kind", SpanKind.CLIENT) - db_parameter_name = next( ( p diff --git a/src/instana/instrumentation/pyramid.py b/src/instana/instrumentation/pyramid.py index 88c3e419..6faed9db 100644 --- a/src/instana/instrumentation/pyramid.py +++ b/src/instana/instrumentation/pyramid.py @@ -36,7 +36,6 @@ def __call__(self, request: "Request") -> "Response": ctx = tracer.extract(Format.HTTP_HEADERS, dict(request.headers)) with tracer.start_as_current_span("wsgi", span_context=ctx) as span: - span.set_attribute("span.kind", SpanKind.SERVER) span.set_attribute("http.host", request.host) span.set_attribute(SpanAttributes.HTTP_METHOD, request.method) span.set_attribute(SpanAttributes.HTTP_URL, request.path) diff --git a/src/instana/instrumentation/sanic_inst.py b/src/instana/instrumentation/sanic_inst.py index 72b0dc26..57758a6d 100644 --- a/src/instana/instrumentation/sanic_inst.py +++ b/src/instana/instrumentation/sanic_inst.py @@ -58,7 +58,6 @@ def request_with_instana(request: Request) -> None: token = context.attach(ctx) request.ctx.token = token - span.set_attribute("span.kind", SpanKind.SERVER) span.set_attribute("http.path", request.path) span.set_attribute(SpanAttributes.HTTP_METHOD, request.method) span.set_attribute(SpanAttributes.HTTP_HOST, request.host) diff --git a/src/instana/span/registered_span.py b/src/instana/span/registered_span.py index 6164ca86..efc826f1 100644 --- a/src/instana/span/registered_span.py +++ b/src/instana/span/registered_span.py @@ -34,9 +34,9 @@ def __init__(self, span, source, service_name, **kwargs) -> None: if "gcps" in span.name: self.n = "gcps" - # Store any leftover attributes in the custom section + # Logic to store custom attributes for registered spans (not used yet) if len(span.attributes) > 0: - self.data["custom"]["attributes"] = self._validate_attributes( + self.data["sdk"]["custom"]["tags"] = self._validate_attributes( span.attributes ) diff --git a/tests/clients/test_pep0249.py b/tests/clients/test_pep0249.py index 6235e6cc..2bd0c6e2 100644 --- a/tests/clients/test_pep0249.py +++ b/tests/clients/test_pep0249.py @@ -116,7 +116,6 @@ def test_collect_kvs(self) -> None: select * from tests; """ self.test_wrapper._collect_kvs(span, sample_sql) - assert span.attributes["span.kind"] == SpanKind.CLIENT assert span.attributes["db.name"] == "instana_test_db" assert span.attributes["db.statement"] == sample_sql assert span.attributes["db.user"] == "root" diff --git a/tests/span/test_registered_span.py b/tests/span/test_registered_span.py index 8d11f737..6d40fb03 100644 --- a/tests/span/test_registered_span.py +++ b/tests/span/test_registered_span.py @@ -66,7 +66,6 @@ def test_collect_http_attributes_with_attributes( ) -> None: span_name = "test-registered-span" attributes = { - "span.kind": "entry", "http.host": "localhost", "http.url": "https://www.instana.com", "http.header.test": "one more test",