Skip to content
Closed
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
25 changes: 13 additions & 12 deletions packages/browser/src/transports/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core';
import { createTransport, rejectedSyncPromise } from '@sentry/core';
import { createTransport, rejectedSyncPromise, suppressTracing } from '@sentry/core';
import { clearCachedImplementation, getNativeImplementation } from '@sentry-internal/browser-utils';
import type { WINDOW } from '../helpers';
import type { BrowserTransportOptions } from './types';
Expand Down Expand Up @@ -45,17 +45,18 @@ export function makeFetchTransport(
}

try {
// TODO: This may need a `suppressTracing` call in the future when we switch the browser SDK to OTEL
return nativeFetch(options.url, requestOptions).then(response => {
pendingBodySize -= requestSize;
pendingCount--;
return {
statusCode: response.status,
headers: {
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
'retry-after': response.headers.get('Retry-After'),
},
};
return suppressTracing(() => {
return nativeFetch(options.url, requestOptions).then(response => {
Comment on lines +48 to +49
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait this seems off. Why would we need to suppress tracing when using nativeFetch? Shouldn't this be instrumentation-free in the first place?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this seems to be true, this is not triggering anything anyhow. Maybe we can just remove the comment and call it a day 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I don't see us switching to browser OTel anytime soon 😅

pendingBodySize -= requestSize;
pendingCount--;
return {
statusCode: response.status,
headers: {
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
'retry-after': response.headers.get('Retry-After'),
},
};
});
});
} catch (e) {
clearCachedImplementation('fetch');
Expand Down
Loading