Skip to content

docs(js): Add warning for usage of beforeSendSpan #11915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/platforms/javascript/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ This function is called with an SDK-specific transaction event object, and can r

<ConfigKey name="before-send-span">

<Include name="platforms/configuration/options/warn-before-send-span.mdx" />

This function is called with a serialized span object, and can return a modified span object, or `null` to skip sending the span. This might be useful for manually stripping PII from spans or to remove individual spans from the span tree.
This function is only called for child spans of the root span. If you want to modify or drop the root span, including all of its child spans, use [`beforeSendTransaction`](#before-send-transaction) instead.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{/* TODO(v9): Remove this alert in js sdk v9 */}

<Alert level="warning">
In the Sentry JavaScript SDK v9.0.0, the ability to drop spans via `beforeSendSpan` by returning `null` will be removed. The callback will only allow modifying span attributes.
</Alert>
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<Include name="platforms/configuration/options/warn-before-send-span.mdx" />

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
Expand Down
Loading