()
| 202 | } |
| 203 | }, |
| 204 | setupOnce() { |
| 205 | server.setupOnce(); |
| 206 | |
| 207 | const sentryHttpInstrumentationOptions: SentryHttpInstrumentationOptions = { |
| 208 | breadcrumbs: options.breadcrumbs, |
| 209 | spans, |
| 210 | propagateTraceInOutgoingRequests: options.tracePropagation ?? true, |
| 211 | createSpansForOutgoingRequests: spans, |
| 212 | ignoreOutgoingRequests: options.ignoreOutgoingRequests, |
| 213 | outgoingRequestHook: (span: Span, request: HttpClientRequest) => { |
| 214 | // Sanitize data URLs to prevent long base64 strings in span attributes |
| 215 | const url = getRequestUrlFromClientRequest(request); |
| 216 | if (url.startsWith('data:')) { |
| 217 | const sanitizedUrl = stripDataUrlContent(url); |
| 218 | // TODO(v11): Update these to the Sentry semantic attributes. |
| 219 | // https://getsentry.github.io/sentry-conventions/attributes/ |
| 220 | span.setAttribute('http.url', sanitizedUrl); |
| 221 | span.setAttribute(SEMANTIC_ATTRIBUTE_URL_FULL, sanitizedUrl); |
| 222 | span.updateName(`${request.method || 'GET'} ${sanitizedUrl}`); |
| 223 | } |
| 224 | options.instrumentation?.requestHook?.(span, request); |
| 225 | }, |
| 226 | outgoingResponseHook: options.instrumentation?.responseHook, |
| 227 | outgoingRequestApplyCustomAttributes: options.instrumentation?.applyCustomAttributesOnSpan, |
| 228 | }; |
| 229 | |
| 230 | // This is Sentry-specific instrumentation for outgoing request |
| 231 | // breadcrumbs & trace propagation. It uses the diagnostic channels on |
| 232 | // node versions that support it, falling back to monkey-patching when |
| 233 | // needed. |
| 234 | instrumentSentryHttp(sentryHttpInstrumentationOptions); |
| 235 | }, |
| 236 | processEvent(event) { |
| 237 | // Always run this, even if spans are disabled |
| 238 | // The reason being that e.g. the remix integration disables span |
nothing calls this directly
no test coverage detected