UNPKG

autotel

Version:
40 lines (38 loc) 1.27 kB
const require_chunk = require('./chunk-C_NdSu1c.cjs'); let node_module = require("node:module"); node_module = require_chunk.__toESM(node_module, 1); //#region src/register.ts /** * ESM instrumentation registration for Node.js 18.19+ * * This module registers the OpenTelemetry ESM loader hook using the modern * node:module register() API. This eliminates the need for NODE_OPTIONS or * --experimental-loader flags. * * Usage in instrumentation.mjs: * ```typescript * import 'autotel/register'; // MUST be first import! * import { init } from 'autotel'; * * init({ * service: 'my-app', * instrumentations: [...], // or autoInstrumentations: ['express', 'http', 'pino'] * }); * ``` * * Then run: * ```bash * node --import ./instrumentation.mjs src/index.js * # or with tsx: * tsx --import ./instrumentation.mjs src/index.ts * ``` * * No NODE_OPTIONS or --experimental-loader needed! * * @requires Node.js 18.19.0 or later * @see https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/esm-support.md * @see https://nodejs.org/api/module.html#moduleregisterspecifier-parenturl-options */ node_module.register("@opentelemetry/instrumentation/hook.mjs", require("url").pathToFileURL(__filename).href); //#endregion //# sourceMappingURL=register.cjs.map