Tracer • Rust AI Agent SDK

Tracer: Global tracer for convenience.

Tracer

Defined in the trace module.

Rust AI Agent SDK

Global tracer for convenience.

Fields

NameTypeDescription
tracesArc<RwLock<HashMap<StringActive traces
exportersArc<RwLock<Vec<Box<dyn TraceExporter>>>>Exporters

Methods

new

rust
fn new() -> Self

Create a new tracer.

add_exporter

rust
fn add_exporter(&self, exporter: impl TraceExporter + 'static) -> ()

Add an exporter.

Parameters:

NameType
exporterimpl TraceExporter + 'static

start_trace

rust
fn start_trace(&self, name: impl Into<String>) -> String

Start a new trace.

Parameters:

NameType
nameimpl Into&lt;String&gt;

end_trace

rust
fn end_trace(&self, trace_id: &str) -> ()

End a trace and export.

Parameters:

NameType
trace_id&str

start_span

rust
fn start_span(&self, trace_id: &str, name: impl Into<String>, kind: SpanKind) -> Option<String>

Start a span in a trace.

Parameters:

NameType
trace_id&str
nameimpl Into&lt;String&gt;
kindSpanKind

end_span

rust
fn end_span(&self, trace_id: &str, span_id: &str) -> ()

End a span in a trace.

Parameters:

NameType
trace_id&str
span_id&str

trace_count

rust
fn trace_count(&self) -> usize

Get trace count.

Source

View on GitHub

praisonai/src/trace/mod.rs at line 382


Related Documentation