Skip to content

Commit

Permalink
doc(core): Improve beforeSendSpan JSDoc (#13131)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Lms24 authored Jul 31, 2024
1 parent 65c6c48 commit 772f945
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/types/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,15 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
beforeSend?: (event: ErrorEvent, hint: EventHint) => PromiseLike<ErrorEvent | null> | 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;

Expand Down

0 comments on commit 772f945

Please sign in to comment.