Skip to main content
VeADK provides application logs and traces to diagnose model calls, tools, and agent execution. Logs record individual events; traces connect operations within a request so you can inspect timing and relationships Tracing uses OpenTelemetry spans and generative AI attributes. Coverage depends on the instrumentation provided by the runtime and tools. External backends also require compatible protocols, endpoints, and credentials See Application logging for log levels and formatting

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 like gen_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:
Traces may contain user input, model responses, and tool data. Before enabling external exporters, confirm the destination, access controls, and retention policy. force_export() requests a flush; it does not prove that the backend received the data

Attaching a tracer to an agent

Complete model configuration first. This example stores traces locally and does not require an external observability backend. Running it prints a model response and the path to a JSON trace file
app.py
After configuring each backend’s endpoint, credentials, and target resource, one tracer can report to multiple platforms. This configuration fragment replaces the tracer above:

Tracer parameters

OpentelemetryTracer accepts the following fields:
InMemoryExporter is managed automatically by OpentelemetryTracer and retains completed, sampled spans. 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. When a global provider already exists, the APMPlusExporter object remains in the exporter list, but its span processor is not registered by this tracer. Cozeloop, TLS, and in-memory exporters are still attached. This also applies to exporters created with ENABLE_APMPLUS=true apmplus_managed_externally only indicates that a provider already existed at initialization. It does not inspect that provider’s destination or confirm delivery to APMPlus. If your application already configures OpenTelemetry, configure the APMPlus destination there and verify the Trace ID in the backend

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:
When all three variables are false (the default), Agent creates no tracer. To trace in that case, construct an OpentelemetryTracer explicitly and pass it via tracers.

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 reduce content captured by VeADK. This is controlled by OpenTelemetryConfig.trace_content.

Local dumping

The in-memory exporter built into OpentelemetryTracer retains spans by session_id. Call dump to export the current session’s spans to a local JSON file for offline analysis:
The exported JSON contains, for each span, its name, span_id, trace_id, start/end times, attributes, and parent span. See In-memory exporter for details.
Last modified on September 19, 2026