Skip to content

Conversation

@toshok
Copy link

@toshok toshok commented Oct 29, 2025

Description

Currently, when a pymongo command fails, this warning is printed to the console:

2025-10-29 11:11:15 WARNING  opentelemetry.trace.status Invalid status description type, expected str

We tracked this down to the line changed in this PR. It's attempting to send a _DocumentOut as the status description.
The change fixes the issue and puts errmsg in the status, but str(error.failure) (similar to the other place we set the span status) would likely also work.

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?

Modified pymongo tests that call CommandTracer#failed to mark failures using a dict, which is compatible with the pymongo _DocumentOut type wrt how errmsg is pulled out.

  • test_pymongo.go / test_failed
  • test_pymongo.go / test_multiple_commands

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

@toshok toshok changed the title [WIP] use the errmsg as the status description instead of the _DocumentOut pymongo: for CommandFailedEvent use the errmsg as the status description instead of the _DocumentOut Oct 29, 2025
@toshok toshok marked this pull request as ready for review October 29, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant