Skip to content

Commit

Permalink
fix(node-experimental): Ignore OPTIONS & HEAD requests (#9001)
Browse files Browse the repository at this point in the history
Similar to express, we want to ignore (incoming) OPTIONS & HEAD
requests.
  • Loading branch information
mydea authored Sep 12, 2023
1 parent 475c295 commit 0e23d4d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/node-experimental/src/integrations/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ export class Http implements Integration {
return isSentryHost(host);
},

ignoreIncomingRequestHook: request => {
const method = request.method?.toUpperCase();
// We do not capture OPTIONS/HEAD requests as transactions
if (method === 'OPTIONS' || method === 'HEAD') {
return true;
}

return false;
},

requireParentforOutgoingSpans: true,
requireParentforIncomingSpans: false,
requestHook: (span, req) => {
Expand Down

0 comments on commit 0e23d4d

Please sign in to comment.