Skip to content

Commit 75fafec

Browse files
committed
issue 1918: Ensure string values for span status and attribute values
1 parent 3478831 commit 75fafec

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def started(self, event: monitoring.CommandStartedEvent):
139139
)
140140
span.set_attribute(SpanAttributes.DB_NAME, event.database_name)
141141
span.set_attribute(SpanAttributes.DB_STATEMENT, statement)
142-
if collection:
142+
if collection and isinstance(collection, str):
143143
span.set_attribute(
144144
SpanAttributes.DB_MONGODB_COLLECTION, collection
145145
)
@@ -193,7 +193,7 @@ def failed(self, event: monitoring.CommandFailedEvent):
193193
if span is None:
194194
return
195195
if span.is_recording():
196-
span.set_status(Status(StatusCode.ERROR, event.failure))
196+
span.set_status(Status(StatusCode.ERROR, str(event.failure)))
197197
try:
198198
self.failed_hook(span, event)
199199
except (

0 commit comments

Comments
 (0)