(options: NodePreloadOptions = {})
| 50 | * By preloading the OTEL instrumentation wrapping still happens early enough that everything works. |
| 51 | */ |
| 52 | export function preloadOpenTelemetry(options: NodePreloadOptions = {}): void { |
| 53 | const { debug } = options; |
| 54 | |
| 55 | if (debug) { |
| 56 | coreDebug.enable(); |
| 57 | } |
| 58 | |
| 59 | initializeEsmLoader(); |
| 60 | |
| 61 | // These are all integrations that we need to pre-load to ensure they are set up before any other code runs |
| 62 | getPreloadMethods(options.integrations).forEach(fn => { |
| 63 | fn(); |
| 64 | |
| 65 | if (debug) { |
| 66 | coreDebug.log(`[Sentry] Preloaded ${fn.id} instrumentation`); |
| 67 | } |
| 68 | }); |
| 69 | } |
| 70 | |
| 71 | function getPreloadMethods(integrationNames?: string[]): ((() => void) & { id: string })[] { |
| 72 | const instruments = getOpenTelemetryInstrumentationToPreload(); |
no test coverage detected