Skip to content

feat(python): Reintroduce Python span streaming docs - #18850

Merged
ericapisani merged 11 commits into
masterfrom
ivana/restore-python-streaming-docs
Aug 5, 2026
Merged

feat(python): Reintroduce Python span streaming docs#18850
ericapisani merged 11 commits into
masterfrom
ivana/restore-python-streaming-docs

Conversation

@sentrivana

@sentrivana sentrivana commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

This reverts commit ba13b79.

We initially merged the streaming docs too early, so we had to revert. This PR reverts the revert and reintroduces the streaming docs again.

Changes on top:

  • fixing sampling context examples as the format has changed (to be consistent with the old format)
  • getting rid of all _experiments mentions as the options are now all top level (except for before_send_span, but we'll make a release with that before we merge this)

DO NOT MERGE. We'll merge once ready.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview Aug 5, 2026 8:51pm
sentry-docs Ready Ready Preview Aug 5, 2026 8:51pm

Request Review

@sentrivana sentrivana changed the title Revert "Revert streamed spans and stream mode docs changes (#18746)" Reintroduce Python span streaming docs Jul 28, 2026
@codeowner-assignment
codeowner-assignment Bot requested a review from a team July 28, 2026 07:31
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Redirect Chain Issues Detected

This PR introduces or contains redirect chains that degrade SEO and add latency.

Content Links Pointing to Redirects (1 found)

These links point to URLs that redirect. Update them to point directly to the final destination:

File Line Current Link Should Be
docs/platforms/python/tracing/configure-sampling/index.mdx 607 /platforms/python/configuration/sampling/#sampling-context /platforms/python/sampling/#sampling-context

Each redirect hop loses ~15% of SEO link equity and adds latency for users.

@sentrivana sentrivana changed the title Reintroduce Python span streaming docs feat(python): Reintroduce Python span streaming docs Jul 28, 2026
Comment thread docs/platforms/python/tracing/configure-sampling/index.mdx
@codeowner-assignment
codeowner-assignment Bot requested a review from a team July 28, 2026 08:53
Comment thread docs/platforms/python/tracing/configure-sampling/index.mdx
Comment thread docs/platforms/python/tracing/configure-sampling/index.mdx
Comment thread docs/platforms/python/configuration/filtering/index.mdx Outdated

@coolguyzone coolguyzone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good!

Co-authored-by: Alex Krawiec <alex.krawiec@sentry.io>
Comment thread platform-includes/performance/dropping-spans/python.mdx Outdated
@ericapisani
ericapisani enabled auto-merge (squash) August 5, 2026 20:41
Comment on lines +10 to +11
if span["attributes"].get(attribute):
span["attributes"][attribute] = "[Sanitized]"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The code directly accesses span["attributes"], but the attributes key is optional. This will cause a KeyError if a span without attributes is processed.
Severity: CRITICAL

Suggested Fix

Before accessing span["attributes"], add a defensive check to ensure the attributes key exists. If it doesn't, you can either return early or initialize it as an empty dictionary, for example: if "attributes" not in span: span["attributes"] = {}.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: platform-includes/configuration/before-send-span/python.mdx#L10-L11

Potential issue: The code examples for the `before_send_span` callback access
`span["attributes"]` without first checking if the `attributes` key exists. According to
the SDK specification, the `attributes` key is optional. If a span without attributes is
processed by a user's callback implementing this example code, it will raise a
`KeyError: 'attributes'`, causing a runtime error in the user's application. This can
prevent spans from being processed correctly.

Also affects:

  • docs/platforms/python/tracing/streamed-spans/index.mdx:328~329

@ericapisani
ericapisani merged commit cb10099 into master Aug 5, 2026
22 checks passed
@ericapisani
ericapisani deleted the ivana/restore-python-streaming-docs branch August 5, 2026 20:55
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.

4 participants