Skip to content

issue 1918: Ensure string values for span status and attribute values #2010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cmpilato
Copy link

@cmpilato cmpilato commented Oct 20, 2023

Description

This aims to fix two cases where data types were deemed invalid, resulting in telemetry not being transmitted to our collector. Specifically:

  • don't set the SpanAttributes.DB_MONGODB_COLLECTION attribute unless the collection is already a string value.
  • str()-ify the event failure details

Fixes #1918

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

So far, only adhoc testing has been done. Without these changes, we fail to receive telemetry data and see these logged warnings:

opentelemetry.trace.status.py, line 54 "Invalid status description type, expected str"
opentelemetry.attributes._init_.py, line 70 "Invalid type dict in attribute value sequence. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or None"

With the changes, the warnings are gone and telemetry data flows as expected. We are using pymongo 4.5.0.

Does This PR Require a Core Repo Change?

  • 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

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 20, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@xrmx
Copy link
Contributor

xrmx commented Oct 21, 2024

@cmpilato could you please rebase this?

@cmpilato cmpilato force-pushed the issue_1918_invalid_attribute_type_fixes branch from 75fafec to fb71a1c Compare October 21, 2024 12:36
@cmpilato
Copy link
Author

@xrmx Rebased as requested.

Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, would be nice to add tests for checking that the code now works where previously it failed. Also would be nice to have a changelog entry.

@cmpilato cmpilato requested a review from a team as a code owner October 21, 2024 19:39
@cmpilato
Copy link
Author

@xrmx I've added a ChangeLog entry, but unfortunately I lack the overall OTEL domain knowledge (and time) to consider a regression test. Maybe somebody could use the issue #1918 reproduction recipe to whip up such a contribution for at least the "collection isn't a string" problem?

@cmpilato cmpilato force-pushed the issue_1918_invalid_attribute_type_fixes branch from 5948f23 to a8fb179 Compare October 22, 2024 13:37
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.

pymongo Invalid type in attribute sequence when using sessions
2 participants