Skip to main content

Module trace

Module trace 

Source
Expand description

OpenTelemetry-compatible trace collector for debug sessions.

Collects span data during an agent session and serializes to OTLP JSON format at session end. All text-bearing attributes are redacted via crate::redact::scrub_content before storage (C-01).

Design notes:

  • Uses explicit begin_X / end_X methods with owned SpanGuard — safe across async .await boundaries because no borrow to TracingCollector is held (C-02).
  • A HashMap<usize, IterationEntry> tracks concurrent iterations (I-03).
  • Drop on TracingCollector flushes partial traces on error/panic paths (C-04).
  • When the otel feature is enabled an mpsc channel forwards completed spans to the OTLP exporter in tracing_init.rs (C-05).

Structs§

LlmAttributes
Attributes for a completed LLM request span.
MemorySearchAttributes
Attributes for a completed memory search span.
SpanData
A completed span ready for OTLP serialization.
SpanGuard
Owned guard returned by begin_* methods. Pass back to end_* to close the span.
ToolAttributes
Attributes for a completed tool call span.
TraceEvent
Event sent over the mpsc channel to the OTLP exporter.
TracingCollector

Enums§

SpanStatus
Span status code (matches OTLP StatusCode values).

Functions§

serialize_otlp_json
Serialize spans to OTLP JSON Protobuf encoding.