Skip to content

Commit 0c4ba76

Browse files
committed
ref(browser): Ensure fetch transport has tracing suppressed
1 parent 48f5253 commit 0c4ba76

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

packages/browser/src/transports/fetch.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core';
2-
import { createTransport, rejectedSyncPromise } from '@sentry/core';
2+
import { createTransport, rejectedSyncPromise, suppressTracing } from '@sentry/core';
33
import { clearCachedImplementation, getNativeImplementation } from '@sentry-internal/browser-utils';
44
import type { WINDOW } from '../helpers';
55
import type { BrowserTransportOptions } from './types';
@@ -45,17 +45,18 @@ export function makeFetchTransport(
4545
}
4646

4747
try {
48-
// TODO: This may need a `suppressTracing` call in the future when we switch the browser SDK to OTEL
49-
return nativeFetch(options.url, requestOptions).then(response => {
50-
pendingBodySize -= requestSize;
51-
pendingCount--;
52-
return {
53-
statusCode: response.status,
54-
headers: {
55-
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
56-
'retry-after': response.headers.get('Retry-After'),
57-
},
58-
};
48+
return suppressTracing(() => {
49+
return nativeFetch(options.url, requestOptions).then(response => {
50+
pendingBodySize -= requestSize;
51+
pendingCount--;
52+
return {
53+
statusCode: response.status,
54+
headers: {
55+
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
56+
'retry-after': response.headers.get('Retry-After'),
57+
},
58+
};
59+
});
5960
});
6061
} catch (e) {
6162
clearCachedImplementation('fetch');

0 commit comments

Comments
 (0)