OpenTelemetry ingestion reference

이 페이지는 아직 귀하의 언어로 번역되지 않았습니다. 현재 작업 중이므로 곧 다시 확인해 주십시오.

This page is the reference for how Amplitude's OTLP endpoints translate OpenTelemetry GenAI spans and log records into Agent Analytics [Agent] events. For setup steps, refer to Send OpenTelemetry traces to Agent Analytics.

Endpoints and protocol

  • Protocol: OTLP over HTTP only, as http/protobuf or http/json, with optional gzip. Amplitude doesn't support OTLP/gRPC. Both endpoints use the same authentication, limits, and response codes.
  • Authentication: The project API key as a Bearer token or as an api_key query parameter. Amplitude doesn't require a per-project enablement request.
  • Supported instrumentation: OpenTelemetry GenAI semantic conventions, OpenInference (llm.*), OpenLLMetry and Traceloop (traceloop.*), OpenLIT, and LiteLLM. Amplitude ignores non-GenAI spans.

Attribute resolution order

Amplitude reads the first attribute present, in this order:

What maps to what

Amplitude doesn't calculate a cost when gen_ai.usage.cost is absent. Refer to How cost is calculated.

A chat call re-sends the whole prompt history, so only the user messages after the last assistant message become a new [Agent] User Message. Amplitude doesn't re-emit replayed history, and a tool-loop continuation whose new input is a tool result doesn't produce a user turn.

The AI SDK's in-process OpenTelemetry exporter uses its own mapping. Refer to OpenTelemetry attribute mapping in the SDK reference.

Agent context attributes

These span attributes record how your agent handled a call from another agent. Amplitude maps each one to its [Agent] property. For what the values mean, refer to Agent context properties.

Amplitude trusts span attributes from any exporter that holds your project API key, the same as events. It doesn't check agent context signatures on spans. Set these attributes from your own verification logic, such as the AI SDK's, and never copy them from an inbound request.

[Agent] Context Trust follows amplitude.context.verify.result: ok records trusted, and any other result records untrusted, whatever amplitude.context.trust says. Without a verify result, Amplitude keeps amplitude.context.trust only when it's none.

Don't copy inbound baggage into identity attributes

OpenTelemetry baggage span processors copy inbound W3C baggage entries into span attributes. A caller from outside your trust boundary can then set your session, user, or agent context. Don't copy inbound baggage keys for session.id, user.id, enduser.id, gen_ai.conversation.id, or any amplitude.* attribute from untrusted callers. Allowlist only the baggage keys you set yourself.

Feature flag attributes

Amplitude reads OpenTelemetry feature flag evaluations from GenAI spans and records each one as an experiment. It reads every feature_flag.evaluation span event first, then the span's own feature_flag.* attributes. Resource attributes don't count.

Every event the span produces carries [Agent] Experiments, plus [Agent] Experiment Key, Variant, Unit, and Provider when exactly one evaluation remains. An evaluation without a variant, such as one that returned an error, adds nothing. When two evaluations share a key, the later one wins, so a span attribute overrides a span event with the same key. The validation rules and the 10-experiment limit match the AI SDK. Refer to Record experiment variants in Agent Analytics.

Claude Platform spans

Amplitude applies these rules only when the span name starts with anthropic. and the span also carries gen_ai.provider.name=anthropic, a com.anthropic.claude-platform or com.anthropic.sdk instrumentation scope, or resource service.name=claude-platform. A generic invoke_agent span, and an Anthropic chat span with any other name, stay on the mapping above.

anthropic.message.stop_reason, then anthropic.session.turn.stop_reason, becomes [Agent] Finish Reason on the AI Response when gen_ai.response.finish_reasons is absent. Amplitude doesn't invent enduser.id or gen_ai.usage.cost. Parent span IDs stay hierarchy. They aren't [Agent] Parent Agent ID.

To add the destination, refer to Send Claude Platform traces.

Log records

The logs endpoint turns an allowlist of agent log events into [Agent] events. Amplitude accepts every other log record and drops it, so you can point a mixed logs pipeline at Amplitude.

Some sources split one model call across two records: one with tokens and cost, and one with the text. Amplitude merges them into one turn in either arrival order. Tokens, cost, and turn counts are counted once, and a resent record changes nothing.

Log identity

Amplitude reads the session, user, and agent from the log record and its resource. A record without a session ID, or without a user ID that can join your data, is skipped rather than stored under a trace ID or as unknown.

Set OTEL_RESOURCE_ATTRIBUTES=enduser.id=<user ID> to choose the user explicitly. It overrides every other rule.

One canonical signal per source

Each source has one signal that carries its turns, so nothing counts twice when you export both traces and logs.

  • Claude Code: Logs carry the turn. Exported claude_code.* spans become [Agent] Span events without tokens or cost.
  • Every other source: Spans carry the turn. GenAI log events only add text to the turn the matching span produced.

Delivery, limits, and responses

Delivery is at least once. Run a Collector with a persistent sending queue and keep retries enabled. An in-memory queue loses buffered spans and log records on restart.

The OTLP receiver never returns 403. Treat a 403 from another hop, such as a CDN or WAF, as a configuration error, not a missing Amplitude enablement.

이 내용이 도움이 되었나요?

For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.

이 페이지에서