Only `add` to trace state if key does not exist by sentrivana · Pull Request #3645 · getsentry/sentry-python · GitHub
Skip to content

Only add to trace state if key does not exist - #3645

Merged
sentrivana merged 3 commits into
potel-basefrom
ivana/potel/trace-state-warnings
Oct 11, 2024
Merged

sentrivana merged 3 commits into
potel-basefrom
ivana/potel/trace-state-warnings

Conversation

@sentrivana

@sentrivana sentrivana commented Oct 11, 2024

Copy link
Copy Markdown
Contributor

trace_state.add will never overwrite existing entries -- this is good. However, everytime it bails, it logs a warning, which then shows up in breadcrumbs in tests.

WARNING  opentelemetry.trace.span:span.py:308 The provided key sentry-sampled already exists.
WARNING  opentelemetry.trace.span:span.py:308 The provided key sentry-sample_rate already exists.
WARNING  opentelemetry.trace.span:span.py:308 The provided key sentry-sampled already exists.
WARNING  opentelemetry.trace.span:span.py:308 The provided key sentry-sample_rate already exists.
WARNING  opentelemetry.trace.span:span.py:308 The provided key sentry-sampled already exists.
...

In this PR we explicitly check before adding.

@sentrivana sentrivana changed the title Only add to trace state if key does not exist Only add to trace state if key does not exist Oct 11, 2024
@codecov

codecov Bot commented Oct 11, 2024

Copy link
Copy Markdown

@sentrivana
sentrivana marked this pull request as ready for review October 11, 2024 12:49
@sentrivana
sentrivana merged commit 1c72747 into potel-base Oct 11, 2024
@sentrivana
sentrivana deleted the ivana/potel/trace-state-warnings branch October 11, 2024 12:54
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.

2 participants