diff --git a/patches/sentry-browser/@sentry+browser+10.24.0+001+request-id-support.patch b/patches/sentry-browser/@sentry+browser+10.24.0+001+request-id-support.patch new file mode 100644 index 0000000000000..85725e4e067b0 --- /dev/null +++ b/patches/sentry-browser/@sentry+browser+10.24.0+001+request-id-support.patch @@ -0,0 +1,15 @@ +diff --git a/node_modules/@sentry/browser/build/npm/esm/tracing/request.js b/node_modules/@sentry/browser/build/npm/esm/tracing/request.js +index da5822e..04f3c80 100644 +--- a/node_modules/@sentry/browser/build/npm/esm/tracing/request.js ++++ b/node_modules/@sentry/browser/build/npm/esm/tracing/request.js +@@ -225,6 +225,10 @@ function xhrCallback( + const span = spans[spanId]; + if (span && sentryXhrData.status_code !== undefined) { + setHttpStatus(span, sentryXhrData.status_code); ++ const requestId = handlerData.xhr.getResponseHeader('x-request-id'); ++ if (requestId) { ++ span.setAttribute('request-id', requestId) ++ } + span.end(); + + onRequestSpanEnd?.(span, { diff --git a/patches/sentry-browser/details.md b/patches/sentry-browser/details.md new file mode 100644 index 0000000000000..947ee51897804 --- /dev/null +++ b/patches/sentry-browser/details.md @@ -0,0 +1,8 @@ +# `@sentry/browser` patches + +### [@sentry+browser+10.24.0+001+request-id-support.patch](@sentry+browser+10.24.0+001+request-id-support.patch) + +Reason: improve developer experience by adding `request-id` to spans related to API calls. This takes request-id from response headers and write it to the span related to that response. With that information it is easier to connect backend request / logs with data retrieved from Sentry. +- Upstream PR/issue: N/A +- E/App issue: https://github.com/Expensify/App/issues/75588 +- PR Introducing Patch: https://github.com/Expensify/App/pull/79883 \ No newline at end of file diff --git a/patches/sentry-core/@sentry+core+10.24.0+002+request-id-support.patch b/patches/sentry-core/@sentry+core+10.24.0+002+request-id-support.patch new file mode 100644 index 0000000000000..4792ef44bb96a --- /dev/null +++ b/patches/sentry-core/@sentry+core+10.24.0+002+request-id-support.patch @@ -0,0 +1,16 @@ +diff --git a/node_modules/@sentry/core/build/esm/fetch.js b/node_modules/@sentry/core/build/esm/fetch.js +index 3c6eafb..33481e8 100644 +--- a/node_modules/@sentry/core/build/esm/fetch.js ++++ b/node_modules/@sentry/core/build/esm/fetch.js +@@ -235,7 +235,10 @@ function _addTracingHeadersToFetchRequest( + function endSpan(span, handlerData) { + if (handlerData.response) { + setHttpStatus(span, handlerData.response.status); +- ++ const requestId = handlerData.response?.headers?.get('x-request-id'); ++ if (requestId) { ++ span.setAttribute('request-id', requestId) ++ } + const contentLength = handlerData.response?.headers?.get('content-length'); + + if (contentLength) { diff --git a/patches/sentry-core/details.md b/patches/sentry-core/details.md index 42a14f37c1d5e..c347d312581d2 100644 --- a/patches/sentry-core/details.md +++ b/patches/sentry-core/details.md @@ -11,3 +11,10 @@ - Upstream PR/issue: https://github.com/getsentry/sentry-javascript/pull/18398 - E/App issue: https://github.com/Expensify/App/issues/76128 - PR Introducing Patch: https://github.com/Expensify/App/pull/76547 + +### [@sentry+core+10.24.0+002+request-id-support.patch](@sentry+core+10.24.0+002+request-id-support.patch) + +Reason: improve developer experience by adding `request-id` to spans related to API calls. This takes request-id from response headers and write it to the span related to that response. With that information it is easier to connect backend request / logs with data retrieved from Sentry. +- Upstream PR/issue: N/A +- E/App issue: https://github.com/Expensify/App/issues/75588 +- PR Introducing Patch: https://github.com/Expensify/App/pull/79883 \ No newline at end of file