Available Instrumentations
OpenInference provides automatic instrumentation for popular LLM frameworks and providers in JavaScript:OpenAI
Auto-instrument OpenAI SDK calls
LangChain
Auto-instrument LangChain.js applications
Anthropic
Auto-instrument Anthropic SDK
AWS Bedrock
Auto-instrument AWS Bedrock calls
Instrumentation Packages
Installation
Install the OpenTelemetry SDK and your chosen instrumentation:Basic Usage
Most instrumentations use the standard OpenTelemetry registration pattern:instrumentation.ts
Manual Instrumentation Required
Some frameworks require manual instrumentation due to their module structure:LangChain.js
LangChain must be manually instrumented:instrumentation.ts
LangChain v0.x
For LangChain 0.x versions:instrumentation.ts
Multiple Instrumentations
You can register multiple instrumentations simultaneously:Configuration Options
Each instrumentation can be configured with trace config options:Common Configuration Options
Environment Variables
Configure instrumentation behavior via environment variables:.env
Suppressing Tracing
All instrumentations respect the OpenTelemetryisTracingSuppressed() flag:
Context Propagation
All instrumentations automatically propagate context attributes set via@arizeai/openinference-core:
Complete Example
instrumentation.ts
app.ts
Testing Instrumentations
When developing or testing instrumented applications:- Use console exporter for local development:
- Enable debug logging to troubleshoot issues:
- Verify context propagation:
Best Practices
Next Steps
Core Package
Use OITracer and context attributes
OpenAI
OpenAI-specific instrumentation docs
LangChain
LangChain-specific instrumentation docs
Examples
View complete examples