OpenTelemetryIdGenerator
A custom OpenTelemetry ID generator implementation provided by the AI SDK. It allows the same trace ID generation and sampling decision logic to be reused across different execution stages of a persistent agent.
Timeline (last 90 days)
When used with OpenTelemetry, the same OpenTelemetryIdGenerator instance needs to be passed both to the tracer provider's idGenerator and sampler and to new OpenTelemetry({ durable }).
Explicitly bridging OpenTelemetryIdGenerator enables the parent trace context and sampling decisions to be passed between steps, with model spans reported in real time and the complete invoke_agent call tree reconstructed when the run completes.
In OpenTelemetry, the IdGenerator is responsible for generating the Trace ID and Span ID for each span, and the Sampler decides whether a given trace is sampled and at what sampling rate; injecting the same OpenTelemetryIdGenerator instance into both idGenerator and sampler ensures that ID generation and sampling decisions share the same state, avoiding broken traces or inconsistent sampling.
All Facts (3)
When used with OpenTelemetry, the same OpenTelemetryIdGenerator instance needs to be passed both to the tracer provider's idGenerator and sampler and to new OpenTelemetry({ durable }).
50%UnverifiedExplicitly bridging OpenTelemetryIdGenerator enables the parent trace context and sampling decisions to be passed between steps, with model spans reported in real time and the complete invoke_agent call tree reconstructed when the run completes.
50%UnverifiedIn OpenTelemetry, the IdGenerator is responsible for generating the Trace ID and Span ID for each span, and the Sampler decides whether a given trace is sampled and at what sampling rate; injecting the same OpenTelemetryIdGenerator instance into both idGenerator and sampler ensures that ID generation and sampling decisions share the same state, avoiding broken traces or inconsistent sampling.
50%