Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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, {
8 changes: 8 additions & 0 deletions patches/sentry-browser/details.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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) {
7 changes: 7 additions & 0 deletions patches/sentry-core/details.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading