If you are tracing into Phoenix,
@arizeai/phoenix-otel re-exports this package’s helpers, context utilities, attribute builders, and OITracer from a single import path alongside Phoenix registration. The wrappers resolve the default tracer when the wrapped function runs, which is useful for experiments and other workflows that swap providers.Installation
Tracing Helpers
This package provides convenient helpers to instrument your functions, agents, and LLM operations with OpenInference spans.withSpan
Wraps any function (sync or async) with OpenTelemetry tracing:traceChain
Convenience wrapper for tracing workflow sequences:traceAgent
Convenience wrapper for tracing autonomous agents:traceTool
Convenience wrapper for tracing external tools:Additional Span-Kind Wrappers
The remaining OpenInference span kinds each have a matching wrapper. LiketraceChain/traceAgent/traceTool, each is a shorthand for withSpan(fn, { ...options, kind }) and accepts the same options minus kind. These wrappers are marked @experimental and may change in a future release.
Decorators
@observe
Decorator for automatically tracing class methods:Customizing Spans
The package offers utilities to track important application metadata using context attribute propagation:All
@arizeai/openinference auto instrumentation packages will pull attributes off of context and add them to spans.Example: setSession
Chaining Setters
Each setter function returns a new active context, so they can be chained together:Manual Span Context Propagation
If you are creating spans manually and want to propagate context attributes, use thegetAttributesFromContext utility:
Attribute Helpers
Generate properly formatted attributes for common LLM operations.getLLMAttributes
Generate attributes for LLM operations:getEmbeddingAttributes
Generate attributes for embedding operations:getRetrieverAttributes
Generate attributes for document retrieval:getToolAttributes
Generate attributes for tool definitions:Trace Config
Control settings like data privacy and payload sizes. You may want to keep sensitive information from being logged for security reasons, or limit the size of base64 encoded images.These values can also be controlled via environment variables. See the configuration spec for more information.
Reference Documentation
OpenInference JS Docs
Full API documentation and examples
npm
Package on npm

