An esbuild plugin that bundles OpenTelemetry Node.js core and contrib instrumentations into your application at build time. Version 4.4.0 is the latest stable release, with active development. It simplifies adding OpenTelemetry tracing to Node.js apps by patching non-builtin packages and supporting configuration of instrumentations via the standard `@opentelemetry/auto-instrumentations-node` API. Differentiators: works specifically with esbuild, serializes instrumentation configuration at build time (leading to limitations on functions in configs), and does not bundle Node.js builtins (which are handled at runtime by the NodeSDK). Peer dependency on esbuild >=0.19.x.
npm install opentelemetry-esbuild-plugin-nodeVerified import paths — ran on the pinned version, not inferred.
Shows minimal configuration to bundle OpenTelemetry Node.js instrumentations into an esbuild output.
Avoid closures or variable references in instrumentation configuration functions; use only parameters.
Initialize the NodeSDK with the appropriate builtin instrumentations (e.g., @opentelemetry/instrumentation-http) to cover builtins.
Use the externalModules option in the plugin AND set the same modules in esbuild's external option.
npm install @opentelemetry/auto-instrumentations-node
npm install esbuild@latest (ensure >=0.19.0)
Use named import: import { openTelemetryPlugin } from 'opentelemetry-esbuild-plugin-node'