Installation
Quick Start
What Gets Traced
The Bedrock integration automatically captures:- Converse API — input messages, output text, model ID, token usage (inputTokens/outputTokens), stop reason, cached token counts
- InvokeModel API — raw request/response, model ID, token usage (supports Claude, Titan, and Llama response formats), stop reason, cached tokens (Claude)
- Errors — captured with error status on the span, re-thrown to caller
Captured Properties
| Property | Source | Description |
|---|---|---|
ai.usage.prompt_tokens | Both APIs | Input/prompt token count |
ai.usage.completion_tokens | Both APIs | Output/completion token count |
ai.usage.cached_tokens | Converse: cacheReadInputTokenCount; Claude InvokeModel: cache_read_input_tokens | Tokens read from cache |
ai.usage.cache_write_tokens | Converse: cacheWriteInputTokenCount | Tokens written to cache |
bedrock.finish_reason | Converse: stopReason; InvokeModel: varies by model | Why the model stopped generating (e.g. end_turn, tool_use, max_tokens) |
Configuration
Using InvokeModel
The wrapper also supports the legacyInvokeModel API. Token usage extraction works with Claude, Titan, and Llama response formats:
Identifying Users
Associate a user with optional traits:Tracking Signals
Track feedback, edits, or custom signals:Flushing and Shutdown
Always callflush() before your process exits to ensure all telemetry is shipped: