From 1e855b70bb9efaddbdd30065106ecc81bde29f5d Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Thu, 2 Jan 2025 16:24:10 +0100 Subject: [PATCH] update beforeSendSpan documentation --- .../javascript/common/configuration/filtering.mdx | 4 ++-- .../configuration/options/warn-before-send-span.mdx | 5 ----- .../configuration/before-send-span/javascript.mdx | 11 ++++------- 3 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 includes/platforms/configuration/options/warn-before-send-span.mdx diff --git a/docs/platforms/javascript/common/configuration/filtering.mdx b/docs/platforms/javascript/common/configuration/filtering.mdx index 51731aadb0547..ccf20975a2721 100644 --- a/docs/platforms/javascript/common/configuration/filtering.mdx +++ b/docs/platforms/javascript/common/configuration/filtering.mdx @@ -229,7 +229,7 @@ Learn more about configuring the sam Available since Javascript SDK version `8.2.0`. -To prevent certain spans from being reported to Sentry, use the configuration option which allows you to provide a function to modify and drop a child span. -This function is only called for child spans of the root span. If you want to modify or drop the root span, including its child spans, use [`beforeSendTransaction`](#using-beforesendtransaction) instead. +Use the configuration option which allows you to provide a function to modify a span. +This function is called for the root span and all child spans. If you want to drop the root span, including its child spans, use [`beforeSendTransaction`](#using-beforesendtransaction) instead. diff --git a/includes/platforms/configuration/options/warn-before-send-span.mdx b/includes/platforms/configuration/options/warn-before-send-span.mdx deleted file mode 100644 index 9963c48bb6226..0000000000000 --- a/includes/platforms/configuration/options/warn-before-send-span.mdx +++ /dev/null @@ -1,5 +0,0 @@ -{/* TODO(v9): Remove this alert in js sdk v9 */} - - - 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. - \ No newline at end of file diff --git a/platform-includes/configuration/before-send-span/javascript.mdx b/platform-includes/configuration/before-send-span/javascript.mdx index 7f7ee5f933608..fe1395becd2b5 100644 --- a/platform-includes/configuration/before-send-span/javascript.mdx +++ b/platform-includes/configuration/before-send-span/javascript.mdx @@ -1,15 +1,12 @@ - - ```javascript Sentry.init({ dsn: "___PUBLIC_DSN___", - // Called for spans + // Called for all spans beforeSendSpan(span) { - // Modify or drop the span here - if (span.description === 'unimportant span') { - // Don't send the span to Sentry - return null; + // Modify the span here + if (span.description === 'should be renamed') { + span.description = 'renamed span'; } return span; },