OpenInference Core

Shared OpenTelemetry tracing foundation for instrumenting LLM applications with OpenInference semantic conventions

Library
npm
v2.5.2
1,153stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
92/100Excellent
Development Activity100
Maintenance100
Community80
Maturity48
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture84
Code Quality82
Innovation80
Learning Curve76

@arizeai/openinference-core is the shared tracing foundation for the OpenInference JS ecosystem — a set of OpenTelemetry-based conventions and instrumentation packages for observing LLM applications. It provides span wrappers (withSpan, traceChain, traceAgent, traceTool), a method decorator (@observe), context-propagated attributes (session id, user id, metadata, tags, prompt templates), and an OITracer/OISpan layer that applies OpenInference semantic conventions plus optional sensitive-data masking on top of a standard OpenTelemetry tracer.

It underpins every other JS package in the monorepo (auto-instrumentations for OpenAI, LangChain, Bedrock, Anthropic, MCP, and more), giving them a common way to emit spans that AI observability platforms (Arize Phoenix, and any OpenTelemetry-compatible backend) can consume and visualize.

What You Get

  • withSpan/traceChain/traceAgent/traceTool helpers to wrap arbitrary functions in OpenInference-conformant spans without hand-writing OpenTelemetry boilerplate
  • An @observe method decorator for adding tracing to class methods declaratively
  • Context propagation helpers for session id, user id, metadata, tags, and prompt template attributes across a trace
  • OITracer/OISpan wrappers around a standard OpenTelemetry tracer that apply OpenInference semantic-convention attributes and configurable sensitive-data masking
  • Type-safe helpers for attaching LLM, retrieval, embedding, and tool-call attributes to spans

Common Use Cases

  • Adding custom application-level tracing (chains, agents, tool calls) on top of auto-instrumented LLM/vector-store calls
  • Propagating session and user identifiers through a trace so observability backends can group spans per conversation or end user
  • Masking sensitive prompt/response content before it’s exported, while still emitting OpenInference-compliant spans for platforms like Arize Phoenix

Under The Hood

Architecture: The package is organized into three areas under src/: trace/ holds OITracer and OISpan (in trace/trace-config/), which wrap a caller-supplied OpenTelemetry Tracer/Span to inject OpenInference semantic-convention attributes and apply configurable masking rules (maskingRules.ts) before spans are exported; helpers/ holds the higher-level ergonomic API (withSpan.ts, wrappers.ts, decorators.ts, attributeHelpers.ts) that most consumers actually import; utils/ holds small type-guard and type-utility functions shared internally. This package has no dependency on any specific LLM provider — it is the shared substrate that provider-specific packages (openinference-instrumentation-openai, -anthropic, -bedrock, -langchain, -mcp, etc.) all import and build their auto-instrumentation on top of.

Tech Stack: TypeScript targeting Node.js and browser environments, built with a multi-target output (CommonJS dist/src, ESM dist/esm, and an esnext build) via the monorepo’s shared build tooling. It depends on the @opentelemetry/* API packages (not a specific SDK/exporter, keeping it exporter-agnostic) and @arizeai/openinference-semantic-conventions for the shared attribute-name constants. The wider Arize-ai/openinference monorepo is majority Python (67%) with a substantial TypeScript component (25%) plus Java and Go instrumentation packages, all built and released together via a shared CI/release pipeline (100 releases, ~72 commits/month).

Code Quality: The test/ directory mirrors src/ closely — trace/utils.test.ts, trace/contextAttributes.test.ts, trace-config/traceConfig.test.ts, trace-config/maskingRules.test.ts, trace-config/OITracer.test.ts, trace-config/OpenInferenceSpan.test.ts, helpers/withSpan.test.ts, helpers/attributeHelpers.test.ts — giving direct unit coverage of both the low-level tracer wrapper and the high-level helper API. The monorepo enforces this consistently across all JS packages via shared lint/test/build tooling, and the overall repo shows very active, well-maintained development (last commit within a day, ~2000 total commits).

API Design: The README leads with a fully runnable Quick Start showing withSpan used end-to-end with a standard OpenTelemetry NodeTracerProvider, which keeps the entry cost low — you register a normal OTel tracer provider and then reach for withSpan/@observe only where you want OpenInference-shaped spans. Naming is consistent with the OpenTelemetry ecosystem it extends (Tracer, Span, SpanKind become OITracer, OISpan, OpenInferenceSpanKind), which keeps the API familiar to anyone who already knows OpenTelemetry.

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