logging package. See Application logging for levels, formatting, and trace correlation.
Core concepts
span
A span is a traceable unit of execution that records a name, start/end times, attributes, and parent-child relationships. VeADK builds a tree of spans for each request, covering nodes such as agent runs, model calls, and tool executions, and annotates them per the generative-AI semantic conventions with attributes likegen_ai.operation.name and gen_ai.span.kind.
The tracer OpentelemetryTracer
OpentelemetryTracer is the unified tracing entry point. It holds a list of exporters, wires each one into the tracing pipeline on initialization, and automatically attaches an in-memory exporter for local retention and dumping.
exporter
An exporter sends span data to a specific backend platform. Each exporter targets one backend and can be used alone or combined. VeADK ships the following exporters:Attaching a tracer to an agent
Tracing is wired in through thetracers field of Agent. Construct an exporter for the target backend, hand it to OpentelemetryTracer, then attach the tracer to the agent:
Tracer parameters
OpentelemetryTracer accepts the following fields:
InMemoryExporter is managed automatically by OpentelemetryTracer and records every span. Do not add it to the exporters list manually, or initialization fails.Reusing a preconfigured global TracerProvider
By default,OpentelemetryTracer creates and sets the global TracerProvider during initialization. If a global TracerProvider already exists at that point (for example, set by another library or the application itself), VeADK reuses it instead of overriding it.
In this case VeADK automatically removes APMPlusExporter from the exporters list, because the existing provider is assumed to be responsible for APMPlus trace reporting. Other exporters (such as CozeloopExporter and TLSExporter) are still registered with that provider. The VeADK in-memory exporter is also attached as usual.
This behavior also applies when
ENABLE_APMPLUS=true auto-creates the exporter: if a global TracerProvider already exists, the auto-created APMPlusExporter is also removed.apmplus_managed_externally property to determine whether the tracer detected an external provider:
Enabling exporters via environment variables
Besides constructing exporters explicitly,Agent attaches the matching exporter at runtime based on the following environment variables (enabled when set to true). If the agent provides no tracers, an OpentelemetryTracer is created automatically:
Content tracing
By default, spans record the input and output content of the agent, model, and tools. In scenarios involving sensitive data, you can disable content capture and keep only the non-content span structure and timing. This is controlled byOpenTelemetryConfig.trace_content.
Local dumping
The in-memory exporter built intoOpentelemetryTracer retains spans by session_id. Call dump to export the current session’s spans to a local JSON file for offline analysis:
span_id, trace_id, start/end times, attributes, and parent span. See In-memory exporter for details.