Skip to content

Commit 2914a6b

Browse files
committed
update CHANGELOG.md
1 parent bcdc2bf commit 2914a6b

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5050
([#3904](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3904))
5151
- build: bump ruff to 0.14.1
5252
([#3842](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3842))
53+
- `opentelemetry-instrumentation-pymongo`: Fix invalid mongodb collection attribute type
54+
([#3942](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3942))
5355

5456
## Version 1.38.0/0.59b0 (2025-10-16)
5557

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,7 @@ def _get_statement_by_command_name(
228228

229229
def _get_command_collection_name(event: CommandEvent) -> str | None:
230230
collection_name = event.command.get(event.command_name)
231-
if (
232-
not collection_name
233-
or not isinstance(collection_name, str)
234-
or ".." in collection_name
235-
or collection_name[0] == "."
236-
or collection_name[-1] == "."
237-
):
231+
if not collection_name or not isinstance(collection_name, str):
238232
return None
239233
return collection_name
240234

instrumentation/opentelemetry-instrumentation-pymongo/tests/test_pymongo.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,7 @@ def test_collection_name_attribute(self):
288288
"test_collection",
289289
),
290290
({"command_name": "find"}, None),
291-
({"command_name": "find", "find": b'invalid'}, None),
292-
({"command_name": "find", "find": ".invalid"}, None),
293-
({"command_name": "find", "find": "invalid."}, None),
294-
({"command_name": "find", "find": "invalid..invalid"}, None),
291+
({"command_name": "find", "find": b"invalid"}, None),
295292
]
296293
for command_attrs, expected in scenarios:
297294
with self.subTest(command_attrs=command_attrs, expected=expected):

0 commit comments

Comments
 (0)