Learning resourcesReviewed · Anthropic

OpenTelemetry tracing for the Claude API

This guide explains Claude API tracing for developers debugging AI applications, but the feature is in beta and exported traces can be incomplete. It compares SDK and API tracing, conversation-content controls and token-counting rules for OpenTelemetry-compatible observability platforms.

Researched 23 Nov 2026

In short.

This guide helps developers and platform teams trace Claude requests and agent sessions, but its beta exports are best effort and cannot provide a complete usage ledger. SDK tracing records client activity and supported client tools; API tracing adds internal model requests, server tools and Managed Agents turns. Combining them provides broader visibility, while requiring careful token aggregation and decisions about exporting conversation content. The page explains the architecture and interpretation rules, but leaves detailed installation to linked guides. Pricing, minimum SDK versions and measured performance overhead are unknown.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete selected documentation page at [https://platform.claude.com/docs/en/manage-claude/opentelemetry.md], including its beta notice, tracing comparison, partner listings, content controls, example explanations, token-accounting rules and availability tables. Linked pages, video content and externally referenced illustrations were not independently assessed. Detailed installation, linked contractual terms, partner behavior, runtime reliability, costs and performance remain untested or unknown where the page supplies no evidence.

The overview

Identity

Anthropic's documentation explains OpenTelemetry tracing for the Claude API and Anthropic SDK. The selected source is [https://platform.claude.com/docs/en/manage-claude/opentelemetry.md]. It covers Messages API requests, Sessions API requests, tool execution and Managed Agents sessions.

The resource is a feature guide with setup comparisons and illustrated traces. Claude Code, the Agent SDK and Cowork have separate monitoring documentation.

Assessment

The guide is useful for deciding where to instrument a Claude application and how to interpret the resulting traces. Its strongest practical details are the distinction between SDK and API coverage, the rules for avoiding duplicate token counts, and the consequences of exporting prompts and responses.

It suits teams connecting Claude activity to an application's existing observability system. A complete deployment still requires the linked setup instructions and destination configuration. Delivery reliability, operational overhead and interoperability have not been independently assessed.

Users

Application developers can use the guide to understand failed requests, latency and tool execution. Platform and observability engineers can use it to connect Claude requests to application traces. Teams building evaluations can use exported conversation content as evaluation material when their data-handling requirements permit it.

Beginners receive definitions of traces and spans plus worked examples. Experienced developers receive span names, attribute names, aggregation rules and platform boundaries, although installation details require additional documentation.

Capabilities

Both SDK and API tracing cover Messages and Sessions requests and token usage. API tracing additionally exposes individual model runs, Managed Agents turns and tools executed by the API. SDK tracing covers client tools executed through the tool runner, tools in a self-hosted sandbox and other API requests such as file uploads.

Traces can be exported to observability platforms accepting OTLP, the OpenTelemetry export protocol. The page lists destinations including Datadog, Grafana Cloud, Honeycomb, Langfuse and Sentry; their individual integrations are not assessed here.

Metadata mode includes identifiers, timing, status and token counts. Full-content mode also includes prompts and responses, supporting conversation inspection and evaluation-building within the documented content limits.

Using it

Requirements

SDK tracing requires an application using the Anthropic SDK, a registered OpenTelemetry tracer provider and export configuration. The comparison table lists no required administrative permission for SDK tracing. API tracing requires an administrator to configure a destination in the Claude Console and can cover requests from any client.

The setup comparison limits API tracing to the Claude API and Claude Platform on AWS. A separate availability table lists broader Messages API feature availability across Bedrock, Google-managed Claude and Microsoft Foundry. That broader listing does not establish API-side export support on those platforms; SDK-specific availability is deferred to the linked SDK guide.

This overview does not establish minimum SDK versions, exact installation commands or destination-specific credentials and configuration.

Mechanism

A trace records a request's path through a system; spans represent individual steps such as a model call or tool execution. The SDK and API use attributes from the OpenTelemetry GenAI semantic conventions. Combining SDK and API tracing can place client activity and server execution within the application's trace.

Token accounting requires choosing one source for each request. For Messages requests with both sources, the guide recommends API spans. The SDK and API request spans share the name anthropic.messages.create, but their kinds distinguish CLIENT from SERVER. Within API tracing, sum request spans or their anthropic.model_request children, never both.

Compaction requires additional handling: SDK totals need anthropic.usage.compaction.input_tokens and anthropic.usage.compaction.output_tokens; API totals need anthropic.compaction spans without also adding the duplicated request-level compaction attributes. Managed Agents totals use anthropic.model_request and anthropic.session.outcome_evaluation spans. Input-token counts already include prompt-cache tokens. Retry duplicates must be removed using trace ID and span ID. SDK fallback usage represents only the model that served the response.

Setup

Choose SDK tracing, API tracing or both according to the execution steps you need to observe. SDK setup involves installing the SDK and registering a tracer provider; API setup involves adding a destination in the Console. Detailed instructions are separate at [https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk] and [https://platform.claude.com/docs/en/manage-claude/opentelemetry/api].

Select a content mode for each SDK client and destination. The default SDK value, metadata_only, excludes model prompts and responses while retaining metadata and descriptive text you provide. The content value enables full content. Configure the maximum content size to fit the destination and any intervening proxy.

Example

The illustrated Messages example starts an application span called answer_question and invokes the SDK tool runner. The first request includes API-side web search and a request to call a custom get_weather tool. The SDK executes that custom tool, then sends a second Messages request containing its result. The resulting trace distinguishes application work, client requests, internal model requests and tool execution.

The Managed Agents example follows a chat request through session events, agent turns and a custom list_issues tool. A session can span multiple traces and threads. Grouping by gen_ai.conversation.id reconstructs one thread; grouping by anthropic.session.id collects the whole session. These examples describe expected trace structures; no execution results are supplied.

Assessment & evidence

Limitations

Export is beta and delivery is best effort. Spans can be lost, and callers can suppress request spans by clearing the sampled flag in traceparent. Exported traces therefore cannot establish exhaustive API usage.

Full-content spans have a default content limit of 0.75 MB. Selecting a partner provider can set a different accepted limit. Oversized content is shortened and marked anthropic.content.truncated. Request spans drop the system prompt and earliest messages first; tool spans drop blocks from the end of their results. Images and documents appear only as their type.

API tracing alone does not cover client tool execution; SDK tracing alone does not expose the API's internal model runs or server tools. The overview also refers to tool-span exceptions documented elsewhere, so exhaustive tool coverage is not established by this page.

Decision rationale

Combined tracing is a reasonable choice when debugging needs to follow work across application code, model execution and tools. Separate spans can help locate where time or failures accumulate. This is an inference from the documented trace structure; no measured debugging improvement or performance benefit is supplied.

Metadata mode offers timing and usage visibility while limiting exported conversation content. Full content adds diagnostic and evaluation material, with additional storage and access considerations. Neither mode solves missing-span accounting, so financial or API-key monitoring needs a more complete usage source.

Alternatives

The guide presents SDK-only and API-only tracing as narrower configurations. SDK-only tracing covers participating SDK clients and supported local tools without requiring Console administrator permission. API-only tracing covers any client on its supported platforms and exposes internal API execution.

For API-key usage, including requests without traces, the page recommends the Usage and Cost Analytics API [https://platform.claude.com/docs/en/manage-claude/usage-cost-analytics-api]. It says usage typically appears within four hours. That serves an accounting purpose alongside tracing.

For Claude Code, the Agent SDK or Cowork, the page directs readers to separate monitoring resources. It provides no comparative evidence for ranking observability vendors.

Evidence

The source is the complete supplied Anthropic documentation page. It provides a coverage comparison, beta notice, content-handling rules, illustrative trace sequences, token-counting instructions and availability tables.

Linked SDK and API setup guides, the span reference, legal terms and partner documentation are separate sources whose contents are not established here. Installation, API requests, trace export, destination interoperability and performance were not tested.

Access & freshness

Costs

The page gives no export pricing, free allowance, destination ingestion or storage rates, or measured SDK overhead. The cost of operating this integration is unknown; the documentation does not establish that export is free.

Token attributes support usage analysis, but missing spans and duplicate accounting can distort totals. The page provides no token prices or conversion from trace attributes to a complete monetary bill.

Rights and data handling

The page says OpenTelemetry export is provided under the customer's Anthropic agreement, including the Beta Services section of the Service Specific Terms [https://www.anthropic.com/legal/service-specific-terms]. Those linked terms are outside the selected page. A documentation redistribution licence is not stated.

The observability destination stores exported content under its own access and retention settings. Metadata mode can still contain agent and tool names and descriptions and MCP server names. Organizations with specified HIPAA, FERPA or K-12 restrictions receive metadata-only destination exports regardless of the selected mode; SDK spans are unaffected by that restriction.

For Messages API requests using zero data retention, the page says exported full content remains in memory until delivery. Managed Agents is not eligible for zero data retention, and enabling OpenTelemetry does not change its retention.

Freshness

The documentation was captured on 23 November 2026 at 23:13:26 UTC. It identifies OpenTelemetry export as beta and states availability across all models, with platform differences between tracing configurations.

The supplied page gives no publication date, revision history or minimum SDK versions. Changes after capture to availability, configuration or content handling are unknown.

Practical next steps

Match the required visibility to SDK tracing, API tracing or both, then confirm support for the intended cloud platform in the relevant setup guide. Identify an OTLP destination and the administrator needed for API-side configuration.

Choose content mode and size limits according to the destination's access, retention and payload constraints. Before relying on usage dashboards, configure one counting source per request, handle compaction and retry duplicates, and use the Usage and Cost Analytics API where complete API-key usage matters.

During implementation, inspect a representative request and tool interaction for span linkage, content truncation and token totals. These are recommended validation steps; their outcomes are unknown.

Evidence for this report

selected-page.txtselected · checked 2026-11-23