OpenTelemetry JavaScript (@opentelemetry/api)

Vendor-neutral tracing, metrics, and context API that libraries and apps instrument once, so any OpenTelemetry-compatible backend can consume it.

Library
npm
v1.9.1
3,441stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
95/100Excellent
Development Activity96
Maintenance100
Community84
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
91/100Excellent
Architecture92
Code Quality90
Innovation85
Learning Curve95

@opentelemetry/api is the stable, vendor-neutral entry point for OpenTelemetry in JavaScript and TypeScript. It ships the interfaces, enums, and no-op default implementations for tracing, metrics, context propagation, and diagnostic logging, letting libraries and applications add instrumentation without depending on any specific telemetry backend or exporter.

The package performs no operations until an SDK (such as @opentelemetry/sdk-trace-node) registers itself as the global implementation, so it’s safe for library authors to bundle it as a direct dependency: end users who never configure an SDK pay no runtime cost beyond a handful of no-op calls. The rest of the OpenTelemetry JS ecosystem — SDKs, exporters, and auto-instrumentations for frameworks like Express and Next.js — builds on top of this same API surface, making it the de facto standard for observability instrumentation across the Node.js and browser JavaScript ecosystem.

What You Get

  • Tracing API — Tracer, Span, SpanContext, and context propagation primitives for creating and linking distributed traces
  • Metrics API — Counter, Gauge, Histogram, UpDownCounter, and observable instrument types for recording measurements
  • Context API — a carrier for correlating spans and baggage across async boundaries and service calls
  • Diagnostic logging (DiagLogger) for surfacing SDK and instrumentation issues without a hard console.log dependency
  • No-op default implementations so instrumented code runs safely with zero telemetry backend configured

Common Use Cases

  • Library authors adding built-in tracing/metrics hooks without forcing a specific telemetry vendor on consumers
  • Application teams standardizing on OpenTelemetry before choosing (or while migrating between) backend vendors like Datadog, Honeycomb, or Grafana Tempo
  • Platform teams building custom instrumentation for internal services that must interoperate with auto-instrumented third-party libraries

Under The Hood

Architecture — The API package centers on a define-then-delegate pattern: src/index.ts re-exports typed interfaces (Tracer, Span, Meter, ContextManager, TextMapPropagator, DiagLogger) alongside five module-level singletons (trace, context, diag, metrics, propagation), each instantiated from its own file (trace-api.ts, context-api.ts, etc.) specifically to preserve tree-shaking per signal. Each singleton (e.g. TraceAPI in src/api/trace.ts) wraps a ProxyTracerProvider/ProxyTracer that starts backed by a NoopTracer (src/trace/NoopTracer.ts, NonRecordingSpan.ts) and, when an SDK calls trace.setGlobalTracerProvider(), swaps its internal _delegate to the real implementation — so any Tracer instance obtained before SDK registration keeps working transparently after. Cross-realm/cross-bundle sharing of that single global state goes through src/internal/global-utils.ts, which stashes the registered API under a Symbol.for(‘opentelemetry.js.api.<major>’) key on globalThis, guarded by exact-version compatibility checks in internal/semver.ts (major must match exactly, minor of the caller must be <= minor of the registered global) to prevent a library using a newer, incompatible API surface from crashing an older SDK.

Tech Stack — Pure TypeScript with zero runtime dependencies, built to dual CJS/ESM/ESNext targets via three tsconfig files (tsconfig.json, tsconfig.esm.json, tsconfig.esnext.json) compiled with tsc —build, and a package.json exports map exposing esnext/module/types/default conditions plus a separate ./experimental subpath. It lives inside a large Nx/Lerna-managed monorepo (nx.json, lerna.json) alongside dozens of sibling SDK, exporter, and semantic-conventions packages, but the api package itself is dependency-free by design so instrumented libraries never drag in a full SDK. Dev tooling spans mocha+nyc for Node tests, Karma+webpack for browser/worker tests, dpdm for circular-dependency checks, ESLint/Prettier, and TypeDoc for API reference generation; engines targets Node >=8 while the README promises ES5+ browser compatibility for this package specifically.

Code Quality — Testing is substantial: 21 test files under test/common/** cover diag loggers, context managers, span-context validation, tracestate parsing, proxy-tracer/proxy-provider delegation, noop implementations, semver compatibility, plus a dedicated tree-shaking test and a Node 8 backcompat script, with nyc coverage wired into npm test. Source files are small and single-responsibility (one class per file: NonRecordingSpan.ts, ProxyTracer.ts, NoopMeter.ts), consistently carry SPDX license headers and TSDoc comments with @since version tags on public exports, and lean on TypeScript’s type system rather than runtime checks. internal/semver.ts is representative of the project’s discipline — the exact compatibility rules are documented inline before the implementation, backed by a matching semver.test.ts.

API Design — Ergonomics favor library authors: the entire getting-started snippet is const tracer = trace.getTracer('name', 'version'); const span = tracer.startSpan('op'); span.end();, with the safe no-op default meaning zero required setup for consumers who don’t want telemetry. Naming tracks the OpenTelemetry spec closely (Tracer/Span/SpanContext/SpanKind, Meter/Counter/Histogram/Gauge, ContextManager, TextMapPropagator), matching every other language’s OpenTelemetry SDK and easing cross-language onboarding. Minor friction: a few exports are kept only for back-compat (a deprecated SpanAttributes alias, a TODO comment to remove ProxyTracerProvider in the next major), and the experimental metrics/tracing surface lives behind a separate /experimental subpath import that isn’t obvious without reading the docs.

Used by 75 apps in this directory

TypeScript
99%
Other

Activepieces

Automation · AI Assistants

23,887

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
65
Dependency
Built with
TypeScript99%
Updated today
TypeScript
88%
Other

AFFiNE

Productivity · Project Management · Note Taking

71,668

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
68
Dependency
Built with
TypeScript88%
Updated today
Python
99%
MIT

Agent Lightning

AI Development

17,500

A Microsoft-built training framework that optimizes AI agents with reinforcement learning, automatic prompt optimization, or supervised fine-tuning — with near-zero code changes to your existing agent, in any framework.

View details
84
Repo Health
68
Technical
69
Dependency
Built with
Python99%
Updated today
TypeScript
59%
Other

agenta

Developer Tools · Devops · AI Development

4,489

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript59%
Python39%
Updated today
TypeScript
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,526

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
TypeScript
51%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,087

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
69
Dependency
Built with
TypeScript51%
Rust38%
Updated today
TypeScript
66%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,707

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
94
Repo Health
79
Technical
68
Dependency
Built with
TypeScript66%
Java22%
Updated today
TypeScript
49%
MPL 2.0

Artillery

Devops · Developer Tools

9,054

Cloud-scale load testing and functional testing for APIs, WebSockets, gRPC, and headless browsers, distributed across AWS Lambda or Fargate with zero infrastructure to manage.

View details
89
Repo Health
73
Technical
68
Dependency
Built with
TypeScript49%
JavaScript48%
Updated 5 days ago
TypeScript
100%
MIT

Botpress

AI Assistants · AI Development · Customer Support

14,872

The open-source hub for building and deploying LLM-powered AI agents with TypeScript-first tooling, 40+ integrations, and a revolutionary code-execution agent framework.

View details
95
Repo Health
82
Technical
66
Dependency
Built with
TypeScript100%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search