MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / preloadOpenTelemetry

Function preloadOpenTelemetry

packages/node/src/sdk/initOtel.ts:52–69  ·  view source on GitHub ↗
(options: NodePreloadOptions = {})

Source from the content-addressed store, hash-verified

50 * By preloading the OTEL instrumentation wrapping still happens early enough that everything works.
51 */
52export 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
71function getPreloadMethods(integrationNames?: string[]): ((() => void) & { id: string })[] {
72 const instruments = getOpenTelemetryInstrumentationToPreload();

Callers 1

preload.tsFile · 0.90

Calls 6

initializeEsmLoaderFunction · 0.90
getPreloadMethodsFunction · 0.85
enableMethod · 0.65
forEachMethod · 0.65
logMethod · 0.65
fnFunction · 0.50

Tested by

no test coverage detected