Enable back pressure monitor in Potel by antonpirker · Pull Request #3602 · getsentry/sentry-python · GitHub
Skip to content

Enable back pressure monitor in Potel - #3602

Merged
sl0thentr0py merged 8 commits into
potel-basefrom
antonpirker/potel/back-pressure
Oct 23, 2024
Merged

sl0thentr0py merged 8 commits into
potel-basefrom
antonpirker/potel/back-pressure

Conversation

@antonpirker

Copy link
Copy Markdown
Contributor

This enables back pressure management in POtel.

It down samples in case of the transport not being healthy and also sends outcomes to Sentry.

Right now the sampling is done on span level, but should be done on transaction level, which is not possible right now, because we do not have a reference to the transaction (root span) in the sampler right now. This will be done in a separate PR.

The test that is updated in this PR still fails, because it needs the sample_rate to be somewhere on the Span, but this will be done in a separate PR.

@codecov

codecov Bot commented Oct 3, 2024

Copy link
Copy Markdown

# type: (SpanContext) -> SamplingResult
trace_state = span_context.trace_state.update(SENTRY_TRACE_STATE_DROPPED, "true")

# Tell Sentry why we dropped the transaction/span

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

to match the logic in the earlier tracing impl, we should rather do this at the end of the transaction flow, so I'd not do this here but in span processor on_end and only for the root span case. Here it will apply to every span and the numbers will be wrong.

@antonpirker

Copy link
Copy Markdown
Contributor Author

@antonpirker antonpirker self-assigned this Oct 7, 2024
Comment thread sentry_sdk/integrations/opentelemetry/potel_span_processor.py Outdated
Comment thread sentry_sdk/integrations/opentelemetry/sampler.py Outdated
Comment thread sentry_sdk/integrations/opentelemetry/sampler.py Outdated
@sl0thentr0py
sl0thentr0py merged commit 4179751 into potel-base Oct 23, 2024
@sl0thentr0py
sl0thentr0py deleted the antonpirker/potel/back-pressure branch October 23, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants