Skip to content

Commit

Permalink
feat(remix): Skip span creation for OPTIONS and HEAD requests. [v…
Browse files Browse the repository at this point in the history
…7] (#11485)

Backports #11149 to `v7`
  • Loading branch information
onurtemizkan committed Apr 8, 2024
1 parent 43b83a6 commit 129189b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/remix/src/utils/instrumentServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,13 @@ function wrapRequestHandler(origRequestHandler: RequestHandler, build: ServerBui
return origRequestHandler.call(this, request, loadContext);
}

const upperCaseMethod = request.method.toUpperCase();

// We don't want to wrap OPTIONS and HEAD requests
if (upperCaseMethod === 'OPTIONS' || upperCaseMethod === 'HEAD') {
return origRequestHandler.call(this, request, loadContext);
}

return runWithAsyncContext(async () => {
// eslint-disable-next-line deprecation/deprecation
const hub = getCurrentHub();
Expand Down

0 comments on commit 129189b

Please sign in to comment.