From 772f945cd893b719487b6d2d7e8e9e1211454358 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 31 Jul 2024 12:37:05 +0200 Subject: [PATCH] doc(core): Improve `beforeSendSpan` JSDoc (#13131) This PR changes the `beforeSendSpan` JSDoc analogously to the docs change (https://github.com/getsentry/sentry-docs/pull/10907). It now more clearly points out that `beforeSendSpan` is only called for child spans but not for root spans. ref #13119 --- packages/types/src/options.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/types/src/options.ts b/packages/types/src/options.ts index 82123c01a380..5179c1fdb70e 100644 --- a/packages/types/src/options.ts +++ b/packages/types/src/options.ts @@ -286,11 +286,15 @@ export interface ClientOptions PromiseLike | ErrorEvent | null; /** - * An event-processing callback for spans. This allows a span to be modified before it's sent. - * + * This function can be defined to modify or entirely drop a child span before it's sent. * Returning `null` will cause this span to be dropped. + * + * Note that this function is only called for child spans and not for the root span (formerly known as transaction). + * If you want to modify or drop the root span, use {@link Options.beforeSendTransaction} instead. + * * @param span The span generated by the SDK. - * @returns A new span that will be sent | null. + * + * @returns A new span that will be sent or null if the span should not be sent. */ beforeSendSpan?: (span: SpanJSON) => SpanJSON | null;