Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,29 @@ Sentry.init({

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

### `propagateTrace` renamed to `tracePropagation`

Affected SDKs: `@sentry/core` and dependents.

The low-level HTTP instrumentation helpers exported from `@sentry/core` (`getHttpClientSubscriptions` and
`patchHttpModuleClient`) took a `propagateTrace` option, while the public `httpIntegration` and
`nativeNodeFetchIntegration` options were already named `tracePropagation`. The option is now called
`tracePropagation` at every layer, matching `tracePropagationTargets`:

```js
// before
patchHttpModuleClient(http, { propagateTrace: true });

// after
patchHttpModuleClient(http, { tracePropagation: true });
```

If you only configure `httpIntegration`, `nativeNodeFetchIntegration`, or `denoHttpIntegration`, nothing changes — those
options were already named `tracePropagation`.

This is unrelated to `propagateTraceparent` (whether the W3C `traceparent` header is sent alongside `sentry-trace`) and
`tracePropagationTargets` (which URLs receive trace headers). Both keep their names.

### `tracePropagationTargets` matching is now case-insensitive

Affected SDKs: All SDKs.
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/integrations/http/client-patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ function patchModule(httpModuleExport: HttpModuleExport, options: HttpInstrument
* @example
* ```javascript
* import http from 'http';
* import { patchHttpModule } from '@sentry/core';
* patchHttpModule(http, { propagateTrace: true });
* import { patchHttpModuleClient } from '@sentry/core';
* patchHttpModuleClient(http, { tracePropagation: true });
* ```
*/
export const patchHttpModuleClient = (
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/integrations/http/client-subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function getHttpClientSubscriptions(options: HttpInstrumentationOptions):
const {
errorMonitor = 'error',
spans: createSpans = clientOptions ? hasSpansEnabled(clientOptions) : true,
propagateTrace = false,
tracePropagation = false,
breadcrumbs = true,
http,
https,
Expand Down Expand Up @@ -96,7 +96,7 @@ export function getHttpClientSubscriptions(options: HttpInstrumentationOptions):
if (breadcrumbs) {
breadcrumbsOnly(request);
}
if (propagateTrace) {
if (tracePropagation) {
injectTracePropagationHeaders(request, propagationDecisionMap);
}
return;
Expand All @@ -116,7 +116,7 @@ export function getHttpClientSubscriptions(options: HttpInstrumentationOptions):
// Inject trace headers after span creation so sentry-trace contains the
// outgoing span's ID (not the parent's), enabling downstream services to
// link to this span.
if (propagateTrace) {
if (tracePropagation) {
if (span.isRecording()) {
withActiveSpan(span, () => {
injectTracePropagationHeaders(request, propagationDecisionMap);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/integrations/http/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export interface HttpInstrumentationOptions {
* (`sentry-trace`, `baggage`, `traceparent`) into outgoing requests.
* @default false
*/
propagateTrace?: boolean;
tracePropagation?: boolean;

/**
* Skip span / breadcrumb creation for requests to matching URLs.
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/lib/integrations/http/client-patch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ describe('patchHttpModuleClient', () => {
.mockReturnValueOnce({ [HTTP_ON_CLIENT_REQUEST]: handler1 })
.mockReturnValueOnce({ [HTTP_ON_CLIENT_REQUEST]: handler2 });

patchHttpModuleClient(httpModule, { propagateTrace: true });
patchHttpModuleClient(httpModule, { tracePropagation: true });
const wrappedStoreHeader = httpModule.ClientRequest.prototype._storeHeader;

patchHttpModuleClient(httpModule, { propagateTrace: false });
patchHttpModuleClient(httpModule, { tracePropagation: false });

// The wrapper itself is preserved (no double-wrapping)...
expect(httpModule.ClientRequest.prototype._storeHeader).toBe(wrappedStoreHeader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('getHttpClientSubscriptions', () => {
});

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

withScope(scope => {
Expand Down
2 changes: 1 addition & 1 deletion packages/deno/src/integrations/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const _denoHttpIntegration = ((options: DenoHttpIntegrationOptions = {}) => {
const { [HTTP_ON_CLIENT_REQUEST]: onHttpClientRequest } = getHttpClientSubscriptions({
...options,
breadcrumbs,
propagateTrace: tracePropagation,
tracePropagation,
ignoreOutgoingRequests: options.ignoreOutgoingRequests
? (url, request) => options.ignoreOutgoingRequests!(url, getRequestOptions(request))
: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface OutgoingHttpRequestInstrumentationOptions {
*
* @default `true`
*/
propagateTrace?: boolean;
tracePropagation?: boolean;

/**
* Do not instrument outgoing HTTP requests to URLs where the given callback returns `true`.
Expand Down Expand Up @@ -76,7 +76,7 @@ export function instrumentHttpOutgoingRequests(
const patchOptions = {
applyCustomAttributesOnSpan,
...options,
propagateTrace: options.propagateTrace ?? true,
tracePropagation: options.tracePropagation ?? true,
spans: options.spans ?? true,
ignoreOutgoingRequests(url, request) {
return isTracingSuppressed() || !!options.ignoreOutgoingRequests?.(url, getRequestOptions(request));
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/integrations/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const httpIntegration = defineIntegration((options: HttpOptions = {}) =>
const outgoingRequestOptions: OutgoingHttpRequestInstrumentationOptions = {
breadcrumbs: options.breadcrumbs,
spans,
propagateTrace: options.tracePropagation ?? true,
tracePropagation: options.tracePropagation ?? true,
ignoreOutgoingRequests: options.ignoreOutgoingRequests,
outgoingRequestHook: (span: Span, request: ClientRequest) => {
// Sanitize data URLs to prevent long base64 strings in span attributes
Expand Down
Loading