mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-08-02 19:47:17 +08:00
redis: fix default port KeyError, wrong attr name (#265)
* redis: fix default port KeyError, wrong attr name * fix docker tests and another ip/port issue in asyncpg Co-authored-by: Alex Boten <aboten@lightstep.com>
This commit is contained in:

committed by
GitHub

parent
96b0f592b7
commit
08682f6f1d
@ -46,7 +46,7 @@ class TestFunctionalAsyncPG(TestBase):
|
||||
self.assertEqual(span.attributes["db.name"], POSTGRES_DB_NAME)
|
||||
self.assertEqual(span.attributes["db.user"], POSTGRES_USER)
|
||||
self.assertEqual(span.attributes["net.peer.name"], POSTGRES_HOST)
|
||||
self.assertEqual(span.attributes["net.peer.ip"], POSTGRES_PORT)
|
||||
self.assertEqual(span.attributes["net.peer.port"], POSTGRES_PORT)
|
||||
|
||||
def test_instrumented_execute_method_without_arguments(self, *_, **__):
|
||||
async_call(self._connection.execute("SELECT 42;"))
|
||||
@ -148,7 +148,7 @@ class TestFunctionalAsyncPG_CaptureParameters(TestBase):
|
||||
self.assertEqual(span.attributes["db.name"], POSTGRES_DB_NAME)
|
||||
self.assertEqual(span.attributes["db.user"], POSTGRES_USER)
|
||||
self.assertEqual(span.attributes["net.peer.name"], POSTGRES_HOST)
|
||||
self.assertEqual(span.attributes["net.peer.ip"], POSTGRES_PORT)
|
||||
self.assertEqual(span.attributes["net.peer.port"], POSTGRES_PORT)
|
||||
|
||||
def test_instrumented_execute_method_with_arguments(self, *_, **__):
|
||||
async_call(self._connection.execute("SELECT $1;", "1"))
|
||||
|
@ -35,7 +35,7 @@ class TestRedisInstrument(TestBase):
|
||||
self.assertIs(span.status.status_code, trace.StatusCode.UNSET)
|
||||
self.assertEqual(span.attributes.get("db.name"), 0)
|
||||
self.assertEqual(span.attributes["net.peer.name"], "localhost")
|
||||
self.assertEqual(span.attributes["net.peer.ip"], 6379)
|
||||
self.assertEqual(span.attributes["net.peer.port"], 6379)
|
||||
|
||||
def test_long_command(self):
|
||||
self.redis_client.mget(*range(1000))
|
||||
@ -125,7 +125,7 @@ class TestRedisDBIndexInstrument(TestBase):
|
||||
self.assertEqual(span.name, name)
|
||||
self.assertIs(span.status.status_code, trace.StatusCode.UNSET)
|
||||
self.assertEqual(span.attributes["net.peer.name"], "localhost")
|
||||
self.assertEqual(span.attributes["net.peer.ip"], 6379)
|
||||
self.assertEqual(span.attributes["net.peer.port"], 6379)
|
||||
self.assertEqual(span.attributes["db.redis.database_index"], 10)
|
||||
|
||||
def test_get(self):
|
||||
|
Reference in New Issue
Block a user