Skip to content

Commit a3d4d4f

Browse files
committed
Fix tests
1 parent 1f2a538 commit a3d4d4f

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def started(self, event: monitoring.CommandStartedEvent):
122122
return
123123
command = event.command.get(event.command_name, "")
124124
name = event.database_name
125-
name += "." + event.command_name
125+
name += "." + event.command_name
126126
statement = event.command_name
127127
if command:
128128
statement += " " + str(command)

Diff for: instrumentation/opentelemetry-instrumentation-pymongo/tests/test_pymongo.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def test_pymongo_instrumentor(self):
4040
)
4141
with patch:
4242
PymongoInstrumentor().instrument()
43-
4443
self.assertTrue(mock_register.called)
4544

4645
def test_started(self):
@@ -59,7 +58,7 @@ def test_started(self):
5958
# pylint: disable=protected-access
6059
span = command_tracer._pop_span(mock_event)
6160
self.assertIs(span.kind, trace_api.SpanKind.CLIENT)
62-
self.assertEqual(span.name, "command_name.find")
61+
self.assertEqual(span.name, "database_name.command_name")
6362
self.assertEqual(span.attributes[SpanAttributes.DB_SYSTEM], "mongodb")
6463
self.assertEqual(
6564
span.attributes[SpanAttributes.DB_NAME], "database_name"
@@ -189,8 +188,7 @@ def test_int_command(self):
189188

190189
self.assertEqual(len(spans_list), 1)
191190
span = spans_list[0]
192-
193-
self.assertEqual(span.name, "command_name.123")
191+
self.assertEqual(span.name, "database_name.command_name")
194192

195193

196194
class MockCommand:

0 commit comments

Comments
 (0)