opentelemetry-js
Installation
SKILL.md
OpenTelemetry JavaScript for Node.js
Use this skill for Node.js services written in JavaScript or TypeScript. Do not use it for browser, frontend, React, or Web SDK instrumentation.
Primary source: OpenTelemetry JavaScript docs at https://opentelemetry.io/docs/languages/js/, especially Node.js getting started, instrumentation, libraries, exporters, resources, propagation, and sampling.
First Checks
- Identify module/runtime shape: CommonJS vs ESM, TypeScript runner (
tsx, compiled JS, ts-node), package manager, Node version, and app entrypoint. - The OTel JS SDK 2.x line (current stable
2.10.0;@opentelemetry/sdk-node≥ 0.200, currently0.221.0;@opentelemetry/auto-instrumentations-nodecurrently0.79.0) requires Node^18.19.0 || >=20.6.0. Older Node 14/16/18.0–18.18 are unsupported — verify the runtime before debugging missing spans. CI now also builds on Node 26, but Node 26 is not yet an officially supported runtime. - Check whether instrumentation must run before any app imports. It almost always should.
- Prefer existing project logging/config/env conventions over inventing new wrappers.
- Keep production exporter endpoints, headers, and sampling in environment variables unless the repo already centralizes them in config code.
Dependencies
Core Node SDK setup: