docs(python): update docs under Configuration for stream mode#18510
docs(python): update docs under Configuration for stream mode#18510inventarSarah wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
9eca95c to
aa1827d
Compare
|
|
||
| </Alert> | ||
|
|
||
| You can use the <PlatformIdentifier name="ignore-spans" /> option to filter out spans that match a certain pattern by providing a list of strings, compiled regular expressions, or dictionaries. hen using strings, a span name containing the string will be filtered out. For exact or more complex pattern matching, use compiled regular expressions instead. |
There was a problem hiding this comment.
| You can use the <PlatformIdentifier name="ignore-spans" /> option to filter out spans that match a certain pattern by providing a list of strings, compiled regular expressions, or dictionaries. hen using strings, a span name containing the string will be filtered out. For exact or more complex pattern matching, use compiled regular expressions instead. | |
| You can use the <PlatformIdentifier name="ignore-spans" /> option to filter out spans that match a certain pattern by providing a list of strings, compiled regular expressions, or dictionaries. When using strings, a span name containing the string will be filtered out. For exact or more complex pattern matching, use compiled regular expressions instead. |
🐓
|
|
||
| </Alert> | ||
|
|
||
| A list of strings, compiled regular expressions, or dictionaries that shouldn't be sent to Sentry. When using strings, a span name containing the string will be filtered out. For exact or more complex pattern matching, use compiled regular expressions instead. You can also provide a dictionary with `name` and/or `attributes` keys to match on multiple conditions. At least one key must be provided. |
There was a problem hiding this comment.
| A list of strings, compiled regular expressions, or dictionaries that shouldn't be sent to Sentry. When using strings, a span name containing the string will be filtered out. For exact or more complex pattern matching, use compiled regular expressions instead. You can also provide a dictionary with `name` and/or `attributes` keys to match on multiple conditions. At least one key must be provided. | |
| A list of strings, compiled regular expressions, or dictionaries describing spans that shouldn't be sent to Sentry. When using strings, a span name containing the string will be filtered out. For exact or more complex pattern matching, use compiled regular expressions instead. You can also provide a dictionary with `name` and/or `attributes` keys to match on multiple conditions. At least one key must be provided. |
| ### <PlatformIdentifier name="before-send" />, <PlatformIdentifier name="before-send-transaction" />, & <PlatformIdentifier name="before-send-span" /> | ||
|
|
||
| The SDK provides a <PlatformIdentifier name="before-send" /> hook, which is invoked before an error or message event is sent and can be used to modify event data to remove sensitive information. The SDK also provide a <PlatformIdentifier name="before-send-transaction" /> hook which does the same thing for transactions. We recommend using <PlatformIdentifier name="before-send" /> and <PlatformIdentifier name="before-send-transaction" /> in the SDK to **scrub any data before it is sent**, to ensure that sensitive data never leaves the local environment. | ||
| The SDK provides a <PlatformIdentifier name="before-send" /> hook, which is invoked before an error or message event is sent and can be used to modify event data to remove sensitive information. The SDK also provides a <PlatformIdentifier name="before-send-transaction" /> hook, that does the same thing for transactions, and a <PlatformIdentifier name="before-send-span" /> hook, that does the same thing for service spans in <PlatformLink to="/tracing/new-spans/">stream mode</PlatformLink>. We recommend using these hooks in the SDK to **scrub any data before it is sent**, to ensure that sensitive data never leaves the local environment. |
There was a problem hiding this comment.
All spans pass through before_send_span()
| The SDK provides a <PlatformIdentifier name="before-send" /> hook, which is invoked before an error or message event is sent and can be used to modify event data to remove sensitive information. The SDK also provides a <PlatformIdentifier name="before-send-transaction" /> hook, that does the same thing for transactions, and a <PlatformIdentifier name="before-send-span" /> hook, that does the same thing for service spans in <PlatformLink to="/tracing/new-spans/">stream mode</PlatformLink>. We recommend using these hooks in the SDK to **scrub any data before it is sent**, to ensure that sensitive data never leaves the local environment. | |
| The SDK provides a <PlatformIdentifier name="before-send" /> hook, which is invoked before an error or message event is sent and can be used to modify event data to remove sensitive information. The SDK also provides a <PlatformIdentifier name="before-send-transaction" /> hook, that does the same thing for transactions, and a <PlatformIdentifier name="before-send-span" /> hook, that does the same thing for spans in <PlatformLink to="/tracing/new-spans/">stream mode</PlatformLink>. We recommend using these hooks in the SDK to **scrub any data before it is sent**, to ensure that sensitive data never leaves the local environment. |
| span's lifetime. In contrast, <PlatformIdentifier name="before-send-span" /> can | ||
| only work with attributes set at span start time. Attributes added later during | ||
| the span's lifetime aren't available. |
There was a problem hiding this comment.
Not true, you can remove the sentence 😄
| span's lifetime. In contrast, <PlatformIdentifier name="before-send-span" /> can | |
| only work with attributes set at span start time. Attributes added later during | |
| the span's lifetime aren't available. | |
| span's lifetime. |
| ```python {tabTitle:Stream Mode} | ||
| sentry_sdk.set_attribute({"user.id": user.id}) | ||
|
|
||
| # or | ||
|
|
||
| sentry_sdk.set_attribute({"user.username": user.username}) |
There was a problem hiding this comment.
Bug: The documentation example for sentry_sdk.set_attribute incorrectly passes a dictionary. The function expects a key and a value as two separate arguments.
Severity: MEDIUM
Suggested Fix
Update the incorrect examples to use the correct two-argument call, for instance, sentry_sdk.set_attribute("user.id", user.id). Alternatively, use the plural form sentry_sdk.set_attributes({"user.id": user.id}) if setting multiple attributes from a dictionary is intended.
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/sensitive-data/set-user/python.mdx#L9-L14
Potential issue: The code examples in
`platform-includes/sensitive-data/set-user/python.mdx` for Stream Mode demonstrate
incorrect usage of `sentry_sdk.set_attribute`. The examples pass a dictionary as a
single argument, such as `sentry_sdk.set_attribute({"user.id": user.id})`. However, the
function's signature is `set_attribute(key: str, value: Any)`, requiring two separate
arguments. This will cause a `TypeError` at runtime for any user who copies and runs
this example code. This is inconsistent with other examples in the same pull request,
such as in `set-tag/python.mdx`, which use the correct two-argument format.
Did we get this right? 👍 / 👎 to inform future reviews.
DESCRIBE YOUR PR
This PR updates tracing-relevant pages under Configuration with information about the new stream mode and the new Span APIs.
A note on the Sampling page in this PR: the tracing part on this page is content-wise almost identical to the Configure Sampling under Tracing. In this branch, I did not update the Sampling page; instead, I only linked to the other guide for stream-mode users. I strongly feel we need to streamline these two pages to avoid duplicate maintenance work -- but this needs to be tackled in a separate PR.
Important
Broken links: I added links to the New Spans guide on these pages, but since this guide does not exist in this branch, we get a linting error.
Should only be merged after #18456
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes:
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