Skip to content

Commit 81f0c73

Browse files
committed
issue 1918: Ensure string values for SpanAttributes.DB_MONGODB_COLLECTION
1 parent 185502b commit 81f0c73

File tree

2 files changed

+3
-1
lines changed
  • instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6363
([#3936](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3936))
6464
- `opentelemetry-instrumentation-aiohttp-client`: Update instrumentor to respect suppressing http instrumentation
6565
([#3957](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3957))
66+
- `opentelemetry-instrumentation-pymongo` Fix type-related errors in certain usages of the PyMongo span `DB_MONGODB_COLLECTION` attribute and trace error status descriptions
67+
([#2010](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2010))
6668

6769
## Version 1.38.0/0.59b0 (2025-10-16)
6870

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def started(self, event: monitoring.CommandStartedEvent):
148148
)
149149
span.set_attribute(SpanAttributes.DB_NAME, event.database_name)
150150
span.set_attribute(SpanAttributes.DB_STATEMENT, statement)
151-
if collection:
151+
if collection and isinstance(collection, str):
152152
span.set_attribute(
153153
SpanAttributes.DB_MONGODB_COLLECTION, collection
154154
)

0 commit comments

Comments
 (0)