diff --git a/CHANGELOG.md b/CHANGELOG.md index 45163e7889..cc71d38d2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1424](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1424)) - `opentelemetry-instrumentation-dbapi` Fix the check for the connection already being instrumented in instrument_connection(). ([#1424](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1424)) +- Remove db.name attribute from Redis instrumentation + ([#1427](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1427)) ## Version 1.14.0/0.35b0 (2022-11-03) diff --git a/instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/util.py b/instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/util.py index c5398b42f7..fdc5cb5fd6 100644 --- a/instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/util.py +++ b/instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/util.py @@ -28,7 +28,6 @@ def _extract_conn_attributes(conn_kwargs): SpanAttributes.DB_SYSTEM: DbSystemValues.REDIS.value, } db = conn_kwargs.get("db", 0) - attributes[SpanAttributes.DB_NAME] = db attributes[SpanAttributes.DB_REDIS_DATABASE_INDEX] = db try: attributes[SpanAttributes.NET_PEER_NAME] = conn_kwargs.get( diff --git a/tests/opentelemetry-docker-tests/tests/redis/test_redis_functional.py b/tests/opentelemetry-docker-tests/tests/redis/test_redis_functional.py index 21d7e36b00..db82ec489c 100644 --- a/tests/opentelemetry-docker-tests/tests/redis/test_redis_functional.py +++ b/tests/opentelemetry-docker-tests/tests/redis/test_redis_functional.py @@ -37,7 +37,9 @@ def tearDown(self): def _check_span(self, span, name): self.assertEqual(span.name, name) self.assertIs(span.status.status_code, trace.StatusCode.UNSET) - self.assertEqual(span.attributes.get(SpanAttributes.DB_NAME), 0) + self.assertEqual( + span.attributes.get(SpanAttributes.DB_REDIS_DATABASE_INDEX), 0 + ) self.assertEqual( span.attributes[SpanAttributes.NET_PEER_NAME], "localhost" ) @@ -209,7 +211,9 @@ def tearDown(self): def _check_span(self, span, name): self.assertEqual(span.name, name) self.assertIs(span.status.status_code, trace.StatusCode.UNSET) - self.assertEqual(span.attributes.get(SpanAttributes.DB_NAME), 0) + self.assertEqual( + span.attributes.get(SpanAttributes.DB_REDIS_DATABASE_INDEX), 0 + ) self.assertEqual( span.attributes[SpanAttributes.NET_PEER_NAME], "localhost" )