Skip to content
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

bugfix: OpenTracing Shim not converting exceptions to format expected by OpenTelemetry #4184

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

Conversation

zhihali
Copy link
Contributor

@zhihali zhihali commented Sep 8, 2024

Description

Fixes #4152
Add a sanitize function to make sure the attribute value is converted to string, which align with attributes definition.
Add the warning at logs to better track the error, make sure it will not be ignored after sanitized.

Type of change

Please delete options that are not relevant.

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

How Has This Been Tested?

tox -e lint-opentelemetry-opentracing-shim

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

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

@zhihali zhihali marked this pull request as ready for review September 8, 2024 15:42
@zhihali zhihali requested a review from a team September 8, 2024 15:42
for k, v in key_values.items()
}

self._otel_span.add_event(
Copy link
Contributor

Choose a reason for hiding this comment

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

Since add_event uses BoundedAttributes aren't all values already sanitized to conform to the OpenTelemetry AttributeValue definition?

Copy link
Contributor Author

@zhihali zhihali Sep 10, 2024

Choose a reason for hiding this comment

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

Indeed, but if we don't have these code, the value will not be reformated to str.

Should I do some change in BoundedAttributes?

Copy link
Member

Choose a reason for hiding this comment

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

@zhihali do you mean change _clean_attribute to cast everything else to str?

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.

OpenTracing Shim not converting exceptions to format expected by OpenTelemetry
3 participants