Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def started(self, event: monitoring.CommandStartedEvent):
span.set_attribute("db.instance", event.database_name)
span.set_attribute("db.statement", statement)
if event.connection_id is not None:
span.set_attribute("peer.hostname", event.connection_id[0])
span.set_attribute("peer.port", event.connection_id[1])
span.set_attribute("net.peer.name", event.connection_id[0])
span.set_attribute("net.peer.port", event.connection_id[1])

# pymongo specific, not specified by spec
span.set_attribute("db.mongo.operation_id", event.operation_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def test_started(self):
self.assertEqual(span.attributes["db.type"], "mongodb")
self.assertEqual(span.attributes["db.instance"], "database_name")
self.assertEqual(span.attributes["db.statement"], "command_name find")
self.assertEqual(span.attributes["peer.hostname"], "test.com")
self.assertEqual(span.attributes["peer.port"], "1234")
self.assertEqual(span.attributes["net.peer.name"], "test.com")
self.assertEqual(span.attributes["net.peer.port"], "1234")
self.assertEqual(
span.attributes["db.mongo.operation_id"], "operation_id"
)
Expand Down