Skip to content

Commit fb71a1c

Browse files
committed
issue 1918: Ensure string values for span status and attribute values
1 parent e4ece57 commit fb71a1c

File tree

1 file changed

+2
-2
lines changed
  • instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo

1 file changed

+2
-2
lines changed

instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def started(self, event: monitoring.CommandStartedEvent):
135135
)
136136
span.set_attribute(SpanAttributes.DB_NAME, event.database_name)
137137
span.set_attribute(SpanAttributes.DB_STATEMENT, statement)
138-
if collection:
138+
if collection and isinstance(collection, str):
139139
span.set_attribute(
140140
SpanAttributes.DB_MONGODB_COLLECTION, collection
141141
)
@@ -185,7 +185,7 @@ def failed(self, event: monitoring.CommandFailedEvent):
185185
if span is None:
186186
return
187187
if span.is_recording():
188-
span.set_status(Status(StatusCode.ERROR, event.failure))
188+
span.set_status(Status(StatusCode.ERROR, str(event.failure)))
189189
try:
190190
self.failed_hook(span, event)
191191
except (

0 commit comments

Comments
 (0)