Skip to content

Commit 772f945

Browse files
authored
doc(core): Improve beforeSendSpan JSDoc (#13131)
This PR changes the `beforeSendSpan` JSDoc analogously to the docs change (getsentry/sentry-docs#10907). It now more clearly points out that `beforeSendSpan` is only called for child spans but not for root spans. ref #13119
1 parent 65c6c48 commit 772f945

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/types/src/options.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,15 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
286286
beforeSend?: (event: ErrorEvent, hint: EventHint) => PromiseLike<ErrorEvent | null> | ErrorEvent | null;
287287

288288
/**
289-
* An event-processing callback for spans. This allows a span to be modified before it's sent.
290-
*
289+
* This function can be defined to modify or entirely drop a child span before it's sent.
291290
* Returning `null` will cause this span to be dropped.
291+
*
292+
* Note that this function is only called for child spans and not for the root span (formerly known as transaction).
293+
* If you want to modify or drop the root span, use {@link Options.beforeSendTransaction} instead.
294+
*
292295
* @param span The span generated by the SDK.
293-
* @returns A new span that will be sent | null.
296+
*
297+
* @returns A new span that will be sent or null if the span should not be sent.
294298
*/
295299
beforeSendSpan?: (span: SpanJSON) => SpanJSON | null;
296300

0 commit comments

Comments
 (0)