From f4e4b8be51953be1063f4f22cbb8f030410f6841 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 2 Sep 2026 18:32:39 +0200 Subject: [PATCH 1/2] feat(node): Deprecate `ignoreStatusCodes` in http integrations `ignoreStatusCodes` filters finished transaction events by response status code, which span streaming no longer produces: child spans are sent as they end, long before the response status is known, so a request's spans cannot be dropped retroactively. Since `traceLifecycle: 'stream'` is the default in v11, the option is a no-op for most users, and the static lifecycle it depends on is itself slated for removal. Deprecate it without replacement on `httpIntegration` / `httpServerSpansIntegration` and on Deno's `denoHttpIntegration` / `denoServeIntegration`, to be removed in v12. `ignoreIncomingRequests` is the nearest alternative for keeping requests out of Sentry, but it matches on the request rather than on the response, so it is not equivalent. Fixes #23956 Co-Authored-By: Claude Opus 5 (1M context) --- MIGRATION.md | 23 ++++++++++++++++++- packages/deno/src/integrations/deno-serve.ts | 6 +++++ packages/deno/src/integrations/http.ts | 6 +++++ .../http/httpServerSpansIntegration.ts | 8 +++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/MIGRATION.md b/MIGRATION.md index 994557cbadc4..a37169f794e7 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -481,6 +481,24 @@ Sentry.init({ `ignoreSpans` itself is unchanged in shape, but it now takes effect when a span **starts** rather than when the transaction is sent. Matched spans are never recorded at all, which means a matched non-segment span's children are re-parented to its parent instead of being dropped. +#### `ignoreStatusCodes` is deprecated + +The `ignoreStatusCodes` option is deprecated on `httpIntegration` and `httpServerSpansIntegration` (Node and the SDKs built on it) as well as on `denoHttpIntegration` and `denoServeIntegration`. It will be removed in v12, without replacement. + +The filter runs on the finished transaction event, which span streaming no longer produces. Child spans are sent as they end, long before the response status code is known, so a request's spans can no longer be dropped once the status turns out to be uninteresting. The option therefore only has an effect with `traceLifecycle: 'static'`. + +There is no status-code-based equivalent under span streaming. To keep specific requests out of Sentry, decide before they are instrumented via `ignoreIncomingRequests`, which matches on the incoming request instead of on the response: + +```js +Sentry.init({ + integrations: [ + Sentry.httpIntegration({ + ignoreIncomingRequests: urlPath => urlPath.startsWith('/admin'), + }), + ], +}); +``` + #### Opting out of span streaming To keep the previous transaction-based model, set `traceLifecycle: 'static'`: @@ -656,7 +674,8 @@ Sentry.init({ This filter runs on transaction events (`processEvent`), so it only takes effect when `traceLifecycle` is `'static'`. The default `'stream'` lifecycle does not produce transaction events, and typical Deno apps are unaffected. Node's -`httpIntegration` has the same limitation. +`httpIntegration` has the same limitation. For that reason, [`ignoreStatusCodes` is deprecated](#ignorestatuscodes-is-deprecated) +and will be removed in v12. Transactions that are kept now also carry the HTTP status in the top-level `response` context, as in the other server SDKs. @@ -1424,6 +1443,8 @@ Sentry.httpIntegration({ }); ``` +Note that `ignoreStatusCodes` is itself [deprecated](#ignorestatuscodes-is-deprecated) and will be removed in v12. + ### `@sentry/cloudflare` - The `@sentry/cloudflare/nodejs_compat` subpath export was removed. Since `nodejs_compat` is now required for all users, the main `@sentry/cloudflare` entry point includes everything that was previously only available via the subpath. diff --git a/packages/deno/src/integrations/deno-serve.ts b/packages/deno/src/integrations/deno-serve.ts index 527bb1f062fe..690b05e34d3a 100644 --- a/packages/deno/src/integrations/deno-serve.ts +++ b/packages/deno/src/integrations/deno-serve.ts @@ -29,6 +29,11 @@ export type DenoServeIntegrationOptions = { * produce transaction events, so the filter does not run. * * @default `[[401, 404], [301, 303], [305, 399]]` + * + * @deprecated This option only has an effect if `traceLifecycle` is set to `'static'`. With span streaming + * (`traceLifecycle: 'stream'`, the default), the SDK ignores it: child spans are sent as they end, long before the + * response status code is known, so a request's spans cannot be dropped retroactively. `ignoreStatusCodes` will be + * removed in v12 of the SDK, without replacement. */ ignoreStatusCodes?: (number | [number, number])[]; }; @@ -88,6 +93,7 @@ const instrumentedDenoServe = (serve: typeof Deno.serve): typeof Deno.serve => }); const _denoServeIntegration = ((options: DenoServeIntegrationOptions = {}) => { + // oxlint-disable-next-line typescript/no-deprecated const ignoreStatusCodes = options.ignoreStatusCodes ?? DEFAULT_IGNORE_STATUS_CODES; return { diff --git a/packages/deno/src/integrations/http.ts b/packages/deno/src/integrations/http.ts index f696186b9261..161bf5f7b928 100644 --- a/packages/deno/src/integrations/http.ts +++ b/packages/deno/src/integrations/http.ts @@ -107,6 +107,11 @@ export interface DenoHttpIntegrationOptions { * limitation. * * @default `[[401, 404], [301, 303], [305, 399]]` + * + * @deprecated This option only has an effect if `traceLifecycle` is set to `'static'`. With span streaming + * (`traceLifecycle: 'stream'`, the default), the SDK ignores it: child spans are sent as they end, long before the + * response status code is known, so a request's spans cannot be dropped retroactively. `ignoreStatusCodes` will be + * removed in v12 of the SDK, without replacement. */ ignoreStatusCodes?: (number | [number, number])[]; @@ -146,6 +151,7 @@ export interface DenoHttpIntegrationOptions { const _denoHttpIntegration = ((options: DenoHttpIntegrationOptions = {}) => { const breadcrumbs = options.breadcrumbs ?? true; const tracePropagation = options.tracePropagation ?? true; + // oxlint-disable-next-line typescript/no-deprecated const ignoreStatusCodes = options.ignoreStatusCodes ?? DEFAULT_IGNORE_STATUS_CODES; return { diff --git a/packages/node/src/integrations/http/httpServerSpansIntegration.ts b/packages/node/src/integrations/http/httpServerSpansIntegration.ts index cb9de82677b0..3b14e526705a 100644 --- a/packages/node/src/integrations/http/httpServerSpansIntegration.ts +++ b/packages/node/src/integrations/http/httpServerSpansIntegration.ts @@ -84,7 +84,14 @@ export interface HttpServerSpansIntegrationOptions { * By default, spans with some 3xx and 4xx status codes are ignored (see @default). * Expects an array of status codes or a range of status codes, e.g. [[300,399], 404] would ignore 3xx and 404 status codes. * + * Important: This option is ignored by default! It only has an effect if `traceLifecycle` is set to `'static'`. + * * @default `[[401, 404], [301, 303], [305, 399]]` + * + * @deprecated This option only has an effect if `traceLifecycle` is set to `'static'`. With span streaming + * (`traceLifecycle: 'stream'`, the default), the SDK ignores it: child spans are sent as they end, long before the + * response status code is known, so a request's spans cannot be dropped retroactively. `ignoreStatusCodes` will be + * removed in v12 of the SDK, without replacement. */ ignoreStatusCodes?: (number | [number, number])[]; @@ -98,6 +105,7 @@ export interface HttpServerSpansIntegrationOptions { const _httpServerSpansIntegration = ((options: HttpServerSpansIntegrationOptions = {}) => { const ignoreStaticAssets = options.ignoreStaticAssets ?? true; const ignoreIncomingRequests = options.ignoreIncomingRequests; + // oxlint-disable-next-line typescript/no-deprecated const ignoreStatusCodes = options.ignoreStatusCodes ?? DEFAULT_IGNORE_STATUS_CODES; const { onSpanCreated } = options; From 0b2ba758b5b8a1c3071cb7ab694250de5661d152 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 2 Sep 2026 19:39:07 +0200 Subject: [PATCH 2/2] deslop --- MIGRATION.md | 6 +++--- packages/deno/src/integrations/deno-serve.ts | 4 ++-- packages/deno/src/integrations/http.ts | 4 ++-- .../src/integrations/http/httpServerSpansIntegration.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index a37169f794e7..dadca8ed4cc2 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -483,11 +483,11 @@ Sentry.init({ #### `ignoreStatusCodes` is deprecated -The `ignoreStatusCodes` option is deprecated on `httpIntegration` and `httpServerSpansIntegration` (Node and the SDKs built on it) as well as on `denoHttpIntegration` and `denoServeIntegration`. It will be removed in v12, without replacement. +The `ignoreStatusCodes` option is deprecated on `httpIntegration` and `httpServerSpansIntegration` (Node and the SDKs built on it) as well as on `denoHttpIntegration` and `denoServeIntegration`. It will be removed in v12, without a direct replacement. -The filter runs on the finished transaction event, which span streaming no longer produces. Child spans are sent as they end, long before the response status code is known, so a request's spans can no longer be dropped once the status turns out to be uninteresting. The option therefore only has an effect with `traceLifecycle: 'static'`. +The filter runs on the finished transaction event, which is no longer supported span streaming. Child spans are sent as they end, before the response status code is known, so a request's spans can no longer be dropped once the status turns out to be uninteresting. The option therefore only has an effect with `traceLifecycle: 'static'`. -There is no status-code-based equivalent under span streaming. To keep specific requests out of Sentry, decide before they are instrumented via `ignoreIncomingRequests`, which matches on the incoming request instead of on the response: +To keep specific requests out of Sentry, decide before they are instrumented: Use `tracesSampler`, or ignore the request via `ignoreIncomingRequests`, which matches on the incoming request instead of on the response: ```js Sentry.init({ diff --git a/packages/deno/src/integrations/deno-serve.ts b/packages/deno/src/integrations/deno-serve.ts index 690b05e34d3a..156fb9fd8559 100644 --- a/packages/deno/src/integrations/deno-serve.ts +++ b/packages/deno/src/integrations/deno-serve.ts @@ -31,9 +31,9 @@ export type DenoServeIntegrationOptions = { * @default `[[401, 404], [301, 303], [305, 399]]` * * @deprecated This option only has an effect if `traceLifecycle` is set to `'static'`. With span streaming - * (`traceLifecycle: 'stream'`, the default), the SDK ignores it: child spans are sent as they end, long before the + * (`traceLifecycle: 'stream'`, the default), the SDK ignores it: child spans are sent as they end, before the * response status code is known, so a request's spans cannot be dropped retroactively. `ignoreStatusCodes` will be - * removed in v12 of the SDK, without replacement. + * removed in v12 of the SDK. */ ignoreStatusCodes?: (number | [number, number])[]; }; diff --git a/packages/deno/src/integrations/http.ts b/packages/deno/src/integrations/http.ts index 161bf5f7b928..f4cfeee81d17 100644 --- a/packages/deno/src/integrations/http.ts +++ b/packages/deno/src/integrations/http.ts @@ -109,9 +109,9 @@ export interface DenoHttpIntegrationOptions { * @default `[[401, 404], [301, 303], [305, 399]]` * * @deprecated This option only has an effect if `traceLifecycle` is set to `'static'`. With span streaming - * (`traceLifecycle: 'stream'`, the default), the SDK ignores it: child spans are sent as they end, long before the + * (`traceLifecycle: 'stream'`, the default), the SDK ignores it: child spans are sent as they end, before the * response status code is known, so a request's spans cannot be dropped retroactively. `ignoreStatusCodes` will be - * removed in v12 of the SDK, without replacement. + * removed in v12 of the SDK. */ ignoreStatusCodes?: (number | [number, number])[]; diff --git a/packages/node/src/integrations/http/httpServerSpansIntegration.ts b/packages/node/src/integrations/http/httpServerSpansIntegration.ts index 3b14e526705a..a00d048591a0 100644 --- a/packages/node/src/integrations/http/httpServerSpansIntegration.ts +++ b/packages/node/src/integrations/http/httpServerSpansIntegration.ts @@ -89,7 +89,7 @@ export interface HttpServerSpansIntegrationOptions { * @default `[[401, 404], [301, 303], [305, 399]]` * * @deprecated This option only has an effect if `traceLifecycle` is set to `'static'`. With span streaming - * (`traceLifecycle: 'stream'`, the default), the SDK ignores it: child spans are sent as they end, long before the + * (`traceLifecycle: 'stream'`, the default), the SDK ignores it: child spans are sent as they end, before the * response status code is known, so a request's spans cannot be dropped retroactively. `ignoreStatusCodes` will be * removed in v12 of the SDK, without replacement. */