Skip to content

Commit f7498ce

Browse files
committed
Widen drop http.server spans to 401-404
1 parent 7135d8f commit f7498ce

File tree

2 files changed

+10
-4
lines changed
  • packages

2 files changed

+10
-4
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ interface HttpOptions {
5757
* By default, spans with 404 status code are ignored.
5858
* Expects an array of status codes or a range of status codes, e.g. [[300,399], 404] would ignore 3xx and 404 status codes.
5959
*
60-
* @default `[404]`
60+
* @default `[[401, 404], [300, 399]]`
6161
*/
6262
dropSpansForIncomingRequestStatusCodes?: (number | [number, number])[];
6363

@@ -105,7 +105,10 @@ const instrumentSentryHttp = generateInstrumentOnce<SentryHttpInstrumentationOpt
105105
* It creates breadcrumbs for outgoing HTTP requests which will be attached to the currently active span.
106106
*/
107107
export const httpIntegration = defineIntegration((options: HttpOptions = {}) => {
108-
const dropSpansForIncomingRequestStatusCodes = options.dropSpansForIncomingRequestStatusCodes ?? [404];
108+
const dropSpansForIncomingRequestStatusCodes = options.dropSpansForIncomingRequestStatusCodes ?? [
109+
[401, 404],
110+
[300, 399],
111+
];
109112

110113
return {
111114
name: INTEGRATION_NAME,

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ interface HttpOptions {
7979
* By default, spans with 404 status code are ignored.
8080
* Expects an array of status codes or a range of status codes, e.g. [[300,399], 404] would ignore 3xx and 404 status codes.
8181
*
82-
* @default `[404, [300, 399]]`
82+
* @default `[[401, 404], [300, 399]]`
8383
*/
8484
dropSpansForIncomingRequestStatusCodes?: (number | [number, number])[];
8585

@@ -184,7 +184,10 @@ export function _shouldInstrumentSpans(options: HttpOptions, clientOptions: Part
184184
* It creates breadcrumbs and spans for outgoing HTTP requests which will be attached to the currently active span.
185185
*/
186186
export const httpIntegration = defineIntegration((options: HttpOptions = {}) => {
187-
const dropSpansForIncomingRequestStatusCodes = options.dropSpansForIncomingRequestStatusCodes ?? [404, [300, 399]];
187+
const dropSpansForIncomingRequestStatusCodes = options.dropSpansForIncomingRequestStatusCodes ?? [
188+
[401, 404],
189+
[300, 399],
190+
];
188191

189192
return {
190193
name: INTEGRATION_NAME,

0 commit comments

Comments
 (0)