Skip to content

Commit bfcc018

Browse files
RulaKhaledclaude
andauthored
ref(core)!: Unify tracePropagation vs propagateTrace option names (#23649)
This renames the internal option so one name is used end-to-end. Kept `tracePropagation` as the surviving name rather than renaming the public option back: it is already the released public name in three integrations, and it reads naturally next to `tracePropagationTargets`. `propagateTraceparent` and `tracePropagationTargets` are deliberately untouched — they are separate concepts, and `propagateTraceparent` is a released top-level client option. _Breaking:_ `HttpInstrumentationOptions` is exported from `@sentry/core`, so this changes the public signature of `getHttpClientSubscriptions` and `patchHttpModuleClient`. Fixes #23571 --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 2325c8d commit bfcc018

9 files changed

Lines changed: 36 additions & 13 deletions

File tree

MIGRATION.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,29 @@ Sentry.init({
591591

592592
`sessionFlushingDelayMS` is also configurable now, and defaults to `60000` (60s) as in the other SDKs.
593593

594+
### `propagateTrace` renamed to `tracePropagation`
595+
596+
Affected SDKs: `@sentry/core` and dependents.
597+
598+
The low-level HTTP instrumentation helpers exported from `@sentry/core` (`getHttpClientSubscriptions` and
599+
`patchHttpModuleClient`) took a `propagateTrace` option, while the public `httpIntegration` and
600+
`nativeNodeFetchIntegration` options were already named `tracePropagation`. The option is now called
601+
`tracePropagation` at every layer, matching `tracePropagationTargets`:
602+
603+
```js
604+
// before
605+
patchHttpModuleClient(http, { propagateTrace: true });
606+
607+
// after
608+
patchHttpModuleClient(http, { tracePropagation: true });
609+
```
610+
611+
If you only configure `httpIntegration`, `nativeNodeFetchIntegration`, or `denoHttpIntegration`, nothing changes — those
612+
options were already named `tracePropagation`.
613+
614+
This is unrelated to `propagateTraceparent` (whether the W3C `traceparent` header is sent alongside `sentry-trace`) and
615+
`tracePropagationTargets` (which URLs receive trace headers). Both keep their names.
616+
594617
### `tracePropagationTargets` matching is now case-insensitive
595618

596619
Affected SDKs: All SDKs.

packages/core/src/integrations/http/client-patch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ function patchModule(httpModuleExport: HttpModuleExport, options: HttpInstrument
119119
* @example
120120
* ```javascript
121121
* import http from 'http';
122-
* import { patchHttpModule } from '@sentry/core';
123-
* patchHttpModule(http, { propagateTrace: true });
122+
* import { patchHttpModuleClient } from '@sentry/core';
123+
* patchHttpModuleClient(http, { tracePropagation: true });
124124
* ```
125125
*/
126126
export const patchHttpModuleClient = (

packages/core/src/integrations/http/client-subscriptions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function getHttpClientSubscriptions(options: HttpInstrumentationOptions):
5656
const {
5757
errorMonitor = 'error',
5858
spans: createSpans = clientOptions ? hasSpansEnabled(clientOptions) : true,
59-
propagateTrace = false,
59+
tracePropagation = false,
6060
breadcrumbs = true,
6161
http,
6262
https,
@@ -96,7 +96,7 @@ export function getHttpClientSubscriptions(options: HttpInstrumentationOptions):
9696
if (breadcrumbs) {
9797
breadcrumbsOnly(request);
9898
}
99-
if (propagateTrace) {
99+
if (tracePropagation) {
100100
injectTracePropagationHeaders(request, propagationDecisionMap);
101101
}
102102
return;
@@ -116,7 +116,7 @@ export function getHttpClientSubscriptions(options: HttpInstrumentationOptions):
116116
// Inject trace headers after span creation so sentry-trace contains the
117117
// outgoing span's ID (not the parent's), enabling downstream services to
118118
// link to this span.
119-
if (propagateTrace) {
119+
if (tracePropagation) {
120120
if (span.isRecording()) {
121121
withActiveSpan(span, () => {
122122
injectTracePropagationHeaders(request, propagationDecisionMap);

packages/core/src/integrations/http/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export interface HttpInstrumentationOptions {
148148
* (`sentry-trace`, `baggage`, `traceparent`) into outgoing requests.
149149
* @default false
150150
*/
151-
propagateTrace?: boolean;
151+
tracePropagation?: boolean;
152152

153153
/**
154154
* Skip span / breadcrumb creation for requests to matching URLs.

packages/core/test/lib/integrations/http/client-patch.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ describe('patchHttpModuleClient', () => {
114114
.mockReturnValueOnce({ [HTTP_ON_CLIENT_REQUEST]: handler1 })
115115
.mockReturnValueOnce({ [HTTP_ON_CLIENT_REQUEST]: handler2 });
116116

117-
patchHttpModuleClient(httpModule, { propagateTrace: true });
117+
patchHttpModuleClient(httpModule, { tracePropagation: true });
118118
const wrappedStoreHeader = httpModule.ClientRequest.prototype._storeHeader;
119119

120-
patchHttpModuleClient(httpModule, { propagateTrace: false });
120+
patchHttpModuleClient(httpModule, { tracePropagation: false });
121121

122122
// The wrapper itself is preserved (no double-wrapping)...
123123
expect(httpModule.ClientRequest.prototype._storeHeader).toBe(wrappedStoreHeader);

packages/core/test/lib/integrations/http/client-subscriptions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('getHttpClientSubscriptions', () => {
8181
});
8282

8383
it('does not propagate trace headers when suppressTracing is active', () => {
84-
const subscriptions = getHttpClientSubscriptions({ breadcrumbs: false, spans: false, propagateTrace: true });
84+
const subscriptions = getHttpClientSubscriptions({ breadcrumbs: false, spans: false, tracePropagation: true });
8585
const handler = subscriptions[HTTP_ON_CLIENT_REQUEST];
8686

8787
withScope(scope => {

packages/deno/src/integrations/http.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const _denoHttpIntegration = ((options: DenoHttpIntegrationOptions = {}) => {
119119
const { [HTTP_ON_CLIENT_REQUEST]: onHttpClientRequest } = getHttpClientSubscriptions({
120120
...options,
121121
breadcrumbs,
122-
propagateTrace: tracePropagation,
122+
tracePropagation,
123123
ignoreOutgoingRequests: options.ignoreOutgoingRequests
124124
? (url, request) => options.ignoreOutgoingRequests!(url, getRequestOptions(request))
125125
: undefined,

packages/node/src/integrations/http/SentryHttpInstrumentation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export interface OutgoingHttpRequestInstrumentationOptions {
3838
*
3939
* @default `true`
4040
*/
41-
propagateTrace?: boolean;
41+
tracePropagation?: boolean;
4242

4343
/**
4444
* Do not instrument outgoing HTTP requests to URLs where the given callback returns `true`.
@@ -76,7 +76,7 @@ export function instrumentHttpOutgoingRequests(
7676
const patchOptions = {
7777
applyCustomAttributesOnSpan,
7878
...options,
79-
propagateTrace: options.propagateTrace ?? true,
79+
tracePropagation: options.tracePropagation ?? true,
8080
spans: options.spans ?? true,
8181
ignoreOutgoingRequests(url, request) {
8282
return isTracingSuppressed() || !!options.ignoreOutgoingRequests?.(url, getRequestOptions(request));

packages/node/src/integrations/http/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const httpIntegration = defineIntegration((options: HttpOptions = {}) =>
102102
const outgoingRequestOptions: OutgoingHttpRequestInstrumentationOptions = {
103103
breadcrumbs: options.breadcrumbs,
104104
spans,
105-
propagateTrace: options.tracePropagation ?? true,
105+
tracePropagation: options.tracePropagation ?? true,
106106
ignoreOutgoingRequests: options.ignoreOutgoingRequests,
107107
outgoingRequestHook: (span: Span, request: ClientRequest) => {
108108
// Sanitize data URLs to prevent long base64 strings in span attributes

0 commit comments

Comments
 (0)