Installation
Install the instrumentation package:Quickstart
Install required packages:Configuration
TheAnthropicInstrumentation constructor accepts the following options:
instrumentationConfig: Standard OpenTelemetry instrumentation configurationtraceConfig: OpenInference-specific trace configuration for masking/redacting sensitive informationtracerProvider: Optional custom tracer provider
Supported Features
- Messages API: Full support for
anthropic.messages.create() - Streaming: Automatic handling of streaming responses
- Tool Use: Captures tool/function calling information
- Token Usage: Records input/output token counts when available
- Error Handling: Proper error recording and span status management
Semantic Conventions
This instrumentation follows the OpenInference semantic conventions for LLM observability, capturing:- Model name and provider information
- Input/output messages and content
- Token usage statistics
- Tool calling details
- Invocation parameters