From c9a0fe761b86de13acd1b92085f778d16118b682 Mon Sep 17 00:00:00 2001 From: alrex Date: Mon, 17 Aug 2020 23:50:09 -0500 Subject: [PATCH] Span name updated to follow semantic conventions to reduce cardinality (#972) --- .../CHANGELOG.md | 3 +++ .../instrumentation/aiohttp_client/__init__.py | 2 +- .../tests/test_aiohttp_client_integration.py | 10 +++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/CHANGELOG.md b/instrumentation/opentelemetry-instrumentation-aiohttp-client/CHANGELOG.md index cdbc621d3..78b989563 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/CHANGELOG.md +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +- Updating span name to match semantic conventions + ([#972](https://github.com/open-telemetry/opentelemetry-python/pull/972)) + ## Version 0.12b0 Released 2020-08-14 diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py index 2d9b8bd7a..397d5dc80 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py @@ -126,7 +126,7 @@ def create_trace_config( ): http_method = params.method.upper() if trace_config_ctx.span_name is None: - request_span_name = http_method + request_span_name = "HTTP {}".format(http_method) elif callable(trace_config_ctx.span_name): request_span_name = str(trace_config_ctx.span_name(params)) else: diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py index f44e3df2d..4a48c38ff 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py @@ -118,7 +118,7 @@ class TestAioHttpIntegration(TestBase): self.assert_spans( [ ( - "GET", + "HTTP GET", (span_status, None), { "component": "http", @@ -192,7 +192,7 @@ class TestAioHttpIntegration(TestBase): self.assert_spans( [ ( - "GET", + "HTTP GET", (StatusCanonicalCode.OK, None), { "component": "http", @@ -232,7 +232,7 @@ class TestAioHttpIntegration(TestBase): self.assert_spans( [ ( - "GET", + "HTTP GET", (expected_status, None), { "component": "http", @@ -260,7 +260,7 @@ class TestAioHttpIntegration(TestBase): self.assert_spans( [ ( - "GET", + "HTTP GET", (StatusCanonicalCode.DEADLINE_EXCEEDED, None), { "component": "http", @@ -290,7 +290,7 @@ class TestAioHttpIntegration(TestBase): self.assert_spans( [ ( - "GET", + "HTTP GET", (StatusCanonicalCode.DEADLINE_EXCEEDED, None), { "component": "http",