Skip to content

ref(o11y): Support SDK configured with the streaming trace lifecycle#757

Merged
alexander-alderman-webb merged 38 commits into
mainfrom
webb/streaming-trace-lifecycle
Jul 23, 2026
Merged

ref(o11y): Support SDK configured with the streaming trace lifecycle#757
alexander-alderman-webb merged 38 commits into
mainfrom
webb/streaming-trace-lifecycle

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Use the sentry_sdk.traces API when the streaming lifecycle is enabled. The transaction-based API should no-op and warns when the lifecycle is enabled (and does with an up-to-date sentry-sdk, the fact that it didn't previously no-op contributed to an incident).

Bump the minimum sentry-sdk version to 2.52.0 since that's the first version in which Scope. set_custom_sampling_context() is a classmethod.

Closes #761

@alexander-alderman-webb
alexander-alderman-webb changed the base branch from main to webb/remove-explicit-status July 21, 2026 11:33
@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review July 21, 2026 13:19
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner July 21, 2026 13:19
Comment thread clients/python/src/taskbroker_client/worker/workerchild.py Outdated
Comment thread clients/python/src/taskbroker_client/worker/workerchild.py Outdated
Comment thread clients/python/src/taskbroker_client/worker/workerchild.py Outdated
Comment thread clients/python/src/taskbroker_client/worker/workerchild.py Outdated
Comment thread clients/python/src/taskbroker_client/registry.py Outdated
Comment thread clients/python/src/taskbroker_client/worker/workerchild.py Outdated
Comment thread clients/python/src/taskbroker_client/sdk.py
Comment thread clients/python/src/taskbroker_client/registry.py Outdated
Comment thread clients/python/src/taskbroker_client/worker/workerchild.py Outdated
readme = "README.md"
dependencies = [
"sentry-arroyo>=2.41.0",
"sentry-sdk[http2]>=2.43.0",

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.

We should bump the minimum to the latest, so Span Streaming is fully available.

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.

this is a library, we should not arbitrarily restrict its version ranges unless actually required

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.

It is required, hence I raised it 😄

@alexander-alderman-webb alexander-alderman-webb Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Bumped 106634c / 6b478e6

Comment thread clients/python/src/taskbroker_client/sdk.py Outdated

@markstory markstory left a comment

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.

Makes sense to me.

Comment thread clients/python/src/taskbroker_client/sdk.py
Comment thread clients/python/src/taskbroker_client/sdk.py
Comment thread clients/python/src/taskbroker_client/sdk.py
Comment thread clients/python/pyproject.toml Outdated
Comment thread clients/python/src/taskbroker_client/sdk.py
Comment thread clients/python/src/taskbroker_client/worker/workerchild.py
Base automatically changed from webb/remove-explicit-status to main July 23, 2026 13:21

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 213edcd. Configure here.

Comment thread clients/python/src/taskbroker_client/worker/workerchild.py
Comment thread clients/python/src/taskbroker_client/worker/workerchild.py
@alexander-alderman-webb

Copy link
Copy Markdown
Contributor Author

args/kwargs can be huge, does the sdk trim/stringify this efficiently?

No it doesn't on the streaming trace lifecycle path.
They eagerly go through repr so memory use may be a concern here (depending on the size of the list and dictionary). The serializer for transactions has various limits, but the new logic walks the whole list for args and dictionary for kwargs.

Would it be possible to remove the attributes? We could also put in itertools.islice() or similar to get the first 10 entries, since that's what effectively happened before.

@untitaker

Copy link
Copy Markdown
Member

Would it be possible to remove the attributes? We could also put in itertools.islice() or similar to get the first 10 entries, since that's what effectively happened before.

😅 yeah that trimming is in the sdk for a reason.

i guess we could remove the attributes? kinda sad. some of them can be 40 MB large

@alexander-alderman-webb

Copy link
Copy Markdown
Contributor Author

I've kept the transaction-based logic the same and do not attach the attributes in the streaming trace lifecycle now.

I'd have to take a closer look at what's in args and kwargs if we want to keep the attributes. If that'd be important let me know and I'll add some logic to walk the objects how we did with transaction data.

@untitaker

Copy link
Copy Markdown
Member

well, i would not want to maintain this logic in taskbroker, so i think it's fine

@alexander-alderman-webb
alexander-alderman-webb merged commit 3db8d2d into main Jul 23, 2026
30 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/streaming-trace-lifecycle branch July 23, 2026 16:07
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.

Make sentry-sdk use more defensive

5 participants