Expand description
Observability — oxi-sdk 0.26.2 tracing, cost tracking, and audit.
Provides global instances of oxi-sdk’s Tracer, CostTracker, and AuditLog
for use across the kernel. These complement the existing metrics module
(Prometheus counters/gauges) with distributed tracing, per-agent cost
accounting, and structured audit logging.
§Architecture
Global instances (OnceLock):
tracer() → Tracer (distributed spans: AgentSpan, ToolSpan, etc.)
cost_tracker() → CostTracker (per-agent token/cost tracking)
audit_log() → AuditLog (structured security audit entries)§Usage
use oxios_kernel::observability;
// Start a span for an agent execution
let _span = observability::tracer().start("seed-execution", observability::SpanKind::Agent);
// Log audit entry
observability::audit_log()
.log(observability::AuditEntry::tool_execution(
"agent-1".into(),
"exec".into(),
"ls -la".into(),
true,
42,
));Structs§
- Audit
Filter - Filter criteria for querying the audit log.
- Audit
Log - Audit log — append-only event recorder with query and subscription.
- Cost
Breakdown - Cost breakdown by category (USD).
- Cost
Snapshot - Per-agent cost snapshot.
- Cost
Tracker - Cost tracker — accumulates token usage and computed costs per agent.
- Cost
Tracker Config - Configuration for the cost tracker.
- Global
Cost Snapshot - Global cost snapshot across all agents.
- Span
- Span
Context - Span
Guard - SpanId
- Unique span identifier.
- Token
Usage - Token usage broken down by component.
- TraceId
- Unique trace identifier.
- Tracer
Enums§
- Audit
Entry - An audit trail entry.
- Span
Kind - Span
Status
Functions§
- audit_
log - Get the global AuditLog.
- cost_
tracker - Get the global CostTracker.
- init
- Initialize all observability instances.
- tracer
- Get the global Tracer.