Skip to content

Ensure tag values are strings #4391

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
szokeasaurusrex opened this issue May 14, 2025 — with Linear · 0 comments
Open

Ensure tag values are strings #4391

szokeasaurusrex opened this issue May 14, 2025 — with Linear · 0 comments
Labels

Comments

Copy link
Member

szokeasaurusrex commented May 14, 2025

Tag values must be strings; however, the Python SDK's methods for setting tags (set_tag on the Scope, on Span, and perhaps elsewhere) are defined as taking type Any for the value, and we do not convert the value to a string before setting the tag.

While this appears to not be a problem for most users (likely our transport handles non-string-valued tags), it becomes a problem for users who wish to serialize the envelopes to send them with another service, like Sentry CLI. Since our spec requires tags to have string values, other services, in particular Sentry CLI, will refuse to accept envelopes created by the Python SDK when they contain a tag with a non-string value. See for example the issue CLI-80 (GitHub getsentry/sentry-cli#2505), which is caused by the Python SDK setting a non-string-valued tag.

My proposed solution is to modify all of our set_tag functions to convert all values to strings before setting them on the tag. If the conversion fails, we don't set the tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant