Skip to content

Conversation

@herin049
Copy link
Contributor

Description

Fixes an issue where the Mongodb collection name attribute is occasionally incorrectly set to a non-string value for commands that do not operate on collections. The fix implemented is not able to perfectly identifying commands that operate on collections, but compared to the alternative of directly enumerating all collection-based commands, this fix should be adequate for the time being.

Fixes #3940

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

A unit test with several scenarios has been added to validate that only valid collection names are used for the collection name attribute.

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@herin049 herin049 force-pushed the fix-mongodb-collection-type-error branch from 2914a6b to 0903b39 Compare November 17, 2025 19:03
@xrmx xrmx merged commit fcbe18d into open-telemetry:main Nov 18, 2025
647 checks passed
@github-project-automation github-project-automation bot moved this from Ready for review to Done in @xrmx's Python PR digest Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Invalid type dict in attribute 'db.mongodb.collection' value sequence. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or None

8 participants