Skip to content

Commit a89bbc8

Browse files
hectorhdzgtoumorokoshi
authored andcommitted
1 parent 8a6b408 commit a89bbc8

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

Diff for: ext/opentelemetry-ext-pymongo/src/opentelemetry/ext/pymongo/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def started(self, event: monitoring.CommandStartedEvent):
5757
span.set_attribute("db.instance", event.database_name)
5858
span.set_attribute("db.statement", statement)
5959
if event.connection_id is not None:
60-
span.set_attribute("peer.hostname", event.connection_id[0])
61-
span.set_attribute("peer.port", event.connection_id[1])
60+
span.set_attribute("net.peer.name", event.connection_id[0])
61+
span.set_attribute("net.peer.port", event.connection_id[1])
6262

6363
# pymongo specific, not specified by spec
6464
span.set_attribute("db.mongo.operation_id", event.operation_id)

Diff for: ext/opentelemetry-ext-pymongo/tests/test_pymongo_integration.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def test_started(self):
5454
self.assertEqual(span.attributes["db.type"], "mongodb")
5555
self.assertEqual(span.attributes["db.instance"], "database_name")
5656
self.assertEqual(span.attributes["db.statement"], "command_name find")
57-
self.assertEqual(span.attributes["peer.hostname"], "test.com")
58-
self.assertEqual(span.attributes["peer.port"], "1234")
57+
self.assertEqual(span.attributes["net.peer.name"], "test.com")
58+
self.assertEqual(span.attributes["net.peer.port"], "1234")
5959
self.assertEqual(
6060
span.attributes["db.mongo.operation_id"], "operation_id"
6161
)

Diff for: ext/opentelemetry-ext-wsgi/src/opentelemetry/ext/wsgi/__init__.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,12 @@ def collect_request_attributes(environ):
103103

104104
remote_addr = environ.get("REMOTE_ADDR")
105105
if remote_addr:
106-
result[
107-
"peer.ipv6" if ":" in remote_addr else "peer.ipv4"
108-
] = remote_addr
106+
result["net.peer.ip"] = remote_addr
109107
remote_host = environ.get("REMOTE_HOST")
110108
if remote_host and remote_host != remote_addr:
111-
result["peer.hostname"] = remote_host
109+
result["net.peer.name"] = remote_host
112110

113-
setifnotnone(result, "peer.port", environ.get("REMOTE_PORT"))
111+
setifnotnone(result, "net.peer.port", environ.get("REMOTE_PORT"))
114112
flavor = environ.get("SERVER_PROTOCOL", "")
115113
if flavor.upper().startswith(_HTTP_VERSION_PREFIX):
116114
flavor = flavor[len(_HTTP_VERSION_PREFIX) :]

0 commit comments

Comments
 (0)