|
5 | 5 | BAGGAGE_HEADER_NAME, |
6 | 6 | dynamicSamplingContextToSentryBaggageHeader, |
7 | 7 | isInstanceOf, |
8 | | - isMatchingPattern, |
9 | 8 | } from '@sentry/utils'; |
10 | 9 |
|
11 | 10 | import { getActiveTransaction, hasTracingEnabled } from '../utils'; |
@@ -104,34 +103,13 @@ export const defaultRequestInstrumentationOptions: RequestInstrumentationOptions |
104 | 103 | /** Registers span creators for xhr and fetch requests */ |
105 | 104 | export function instrumentOutgoingRequests(_options?: Partial<RequestInstrumentationOptions>): void { |
106 | 105 | // eslint-disable-next-line @typescript-eslint/unbound-method |
107 | | - const { traceFetch, traceXHR, tracingOrigins, shouldCreateSpanForRequest } = { |
| 106 | + const { traceFetch, traceXHR, shouldCreateSpanForRequest } = { |
108 | 107 | ...defaultRequestInstrumentationOptions, |
109 | 108 | ..._options, |
110 | 109 | }; |
111 | 110 |
|
112 | | - // We should cache url -> decision so that we don't have to compute |
113 | | - // regexp everytime we create a request. |
114 | | - const urlMap: Record<string, boolean> = {}; |
115 | | - |
116 | | - const defaultShouldCreateSpan = (url: string): boolean => { |
117 | | - if (urlMap[url]) { |
118 | | - return urlMap[url]; |
119 | | - } |
120 | | - const origins = tracingOrigins; |
121 | | - urlMap[url] = |
122 | | - origins.some((origin: string | RegExp) => isMatchingPattern(url, origin)) && |
123 | | - !isMatchingPattern(url, 'sentry_key'); |
124 | | - return urlMap[url]; |
125 | | - }; |
126 | | - |
127 | | - // We want that our users don't have to re-implement shouldCreateSpanForRequest themselves |
128 | | - // That's why we filter out already unwanted Spans from tracingOrigins |
129 | | - let shouldCreateSpan = defaultShouldCreateSpan; |
130 | | - if (typeof shouldCreateSpanForRequest === 'function') { |
131 | | - shouldCreateSpan = (url: string) => { |
132 | | - return defaultShouldCreateSpan(url) && shouldCreateSpanForRequest(url); |
133 | | - }; |
134 | | - } |
| 111 | + const shouldCreateSpan = |
| 112 | + typeof shouldCreateSpanForRequest === 'function' ? shouldCreateSpanForRequest : (_: string) => true; |
135 | 113 |
|
136 | 114 | const spans: Record<string, Span> = {}; |
137 | 115 |
|
|
0 commit comments