Skip to content

Commit 9886a70

Browse files
committed
ref(browser): Use suppressTracing for fetch transport
1 parent 9030f37 commit 9886a70

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

packages/browser/src/transports/fetch.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { clearCachedImplementation, getNativeImplementation } from '@sentry-internal/browser-utils';
22
import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core';
3-
import { createTransport, rejectedSyncPromise } from '@sentry/core';
3+
import { createTransport, rejectedSyncPromise, suppressTracing } from '@sentry/core';
44
import type { WINDOW } from '../helpers';
55
import type { BrowserTransportOptions } from './types';
66

@@ -45,18 +45,19 @@ 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-
};
59-
});
48+
return suppressTracing(() =>
49+
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+
}),
60+
);
6061
} catch (e) {
6162
clearCachedImplementation('fetch');
6263
pendingBodySize -= requestSize;

0 commit comments

Comments
 (0)