Skip to content

Commit 3b51968

Browse files
committed
reword and rename stuff to clarify it
1 parent e70507e commit 3b51968

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

packages/core/src/types-hoist/options.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,22 +302,23 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
302302
tracePropagationTargets?: TracePropagationTargets;
303303

304304
/**
305-
* Controls whether trace continuation should be strict about matching organization IDs.
305+
* If set to `true`, the SDK will only continue a trace if the `organization ID` of the incoming trace found in the
306+
* `baggage` header matches the `organization ID` of the current Sentry client.
306307
*
307-
* When set to `true`, the SDK will only continue a trace if the organization ID in the incoming baggage
308-
* matches the organization ID of the current SDK (extracted from the DSN).
308+
* The client's organization ID is extracted from the DSN or can be set with the `orgId` option.
309309
*
310-
* If there is no match, the SDK will start a new trace instead of continuing the incoming one.
310+
* If the organization IDs do not match, the SDK will start a new trace instead of continuing the incoming one.
311+
* This is useful to prevent traces of unknown third-party services from being continued in your application.
311312
*
312313
* @default false
313314
*/
314315
strictTraceContinuation?: boolean;
315316

316317
/**
317-
* The organization ID of the current SDK. The organization ID is a string containing only numbers. This ID is used to
318-
* propagate traces to other Sentry services.
318+
* The organization ID for your Sentry project.
319319
*
320-
* The SDK tries to automatically extract the organization ID from the DSN. With this option, you can override it.
320+
* The SDK will try to extract the organization ID from the DSN. If it cannot be found, or if you need to override it,
321+
* you can provide the ID with this option. The organization ID is used for trace propagation and for features like `strictTraceContinuation`.
321322
*/
322323
orgId?: `${number}` | number;
323324

packages/core/src/utils/tracing.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,25 +136,25 @@ function getSampleRandFromTraceparentAndDsc(
136136
* See https://develop.sentry.dev/sdk/telemetry/traces/#stricttracecontinuation
137137
*/
138138
export function shouldContinueTrace(client: Client, baggageOrgId?: string): boolean {
139-
const sdkOptionOrgId = deriveOrgIdFromClient(client);
139+
const clientOrgId = deriveOrgIdFromClient(client);
140140

141141
// Case: baggage orgID and Client orgID don't match - always start new trace
142-
if (baggageOrgId && sdkOptionOrgId && baggageOrgId !== sdkOptionOrgId) {
142+
if (baggageOrgId && clientOrgId && baggageOrgId !== clientOrgId) {
143143
debug.log(
144-
`Starting a new trace because org IDs don't match (incoming baggage: ${baggageOrgId}, SDK options: ${sdkOptionOrgId})`,
144+
`Won't continue trace because org IDs don't match (incoming baggage: ${baggageOrgId}, SDK options: ${clientOrgId})`,
145145
);
146146
return false;
147147
}
148148

149149
const strictTraceContinuation = client.getOptions()?.strictTraceContinuation || false; // default for `strictTraceContinuation` is `false`
150150

151151
if (strictTraceContinuation) {
152-
// With strict continuation enabled, start new trace if:
152+
// With strict continuation enabled, don't continue trace if:
153153
// - Baggage has orgID, but Client doesn't have one
154154
// - Client has orgID, but baggage doesn't have one
155-
if ((baggageOrgId && !sdkOptionOrgId) || (!baggageOrgId && sdkOptionOrgId)) {
155+
if ((baggageOrgId && !clientOrgId) || (!baggageOrgId && clientOrgId)) {
156156
debug.log(
157-
`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${baggageOrgId}, SDK options: ${sdkOptionOrgId})`,
157+
`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${baggageOrgId}, Sentry client: ${clientOrgId})`,
158158
);
159159
return false;
160160
}

0 commit comments

Comments
 (0)