Skip to main content

Crate telemetry

Crate telemetry 

Source
Expand description

Telemetry — structured event recording with pluggable, callback-based export.

This crate never talks to the network itself: it only defines the event schema, applies per-event-kind filtering and redaction, and hands surviving events to whatever TelemetryRecorder callbacks the caller passes to [spawn]. Where events actually end up (a file, an HTTP endpoint, an OTLP collector, …) is entirely the caller’s decision — see daemon::telemetry_otel for the OTLP recorder this workspace ships.

Default: noop (zero overhead) when disabled or given no recorders. Events are dropped silently if the channel is full — telemetry never blocks the agent.

Re-exports§

pub use config::TelemetryConfig;
pub use config::TelemetryMode;
pub use events::AgentCompletedPayload;
pub use events::AgentSpawnedPayload;
pub use events::ApiErrorPayload;
pub use events::ApiRequestPayload;
pub use events::BudgetEnforcedAction;
pub use events::BudgetEnforcedPayload;
pub use events::CompactActionPayload;
pub use events::CompactKind;
pub use events::EventPayload;
pub use events::HookRunPayload;
pub use events::McpConnectionErrorPayload;
pub use events::McpServerConnectedPayload;
pub use events::PermissionDecisionOutcome;
pub use events::PermissionDecisionPayload;
pub use events::ProviderSwitchedPayload;
pub use events::ResumeActionPayload;
pub use events::ResumeOutcome;
pub use events::SessionEndPayload;
pub use events::SessionStartPayload;
pub use events::SlashCommandUsedPayload;
pub use events::StartupTimingPayload;
pub use events::TeamStageCompletePayload;
pub use events::TelemetryEvent;
pub use events::ToolCancelledPayload;
pub use events::ToolExecutionPayload;
pub use events::ToolOutcome;
pub use events::ToolStartPayload;
pub use events::TurnCompletePayload;
pub use events::TurnStartPayload;
pub use events::UserPromptSubmitPayload;
pub use file_recorder::FileRecorder;
pub use handle::EventFilter;
pub use handle::NoopHandle;
pub use handle::TelemetryHandle;
pub use handle::TelemetryHandleError;
pub use handle::TelemetryRecorder;
pub use redact::RedactionPolicy;
pub use spawn::spawn;
pub use spawn::SpawnError;
pub use spawn::TelemetryConsumer;

Modules§

config
Telemetry configuration — deserialized from settings.json telemetry block.
events
TelemetryEvent 枚举 + 各 payload 结构化定义。
file_recorder
FileRecorder — appends telemetry events as JSONL to a file.
handle
TelemetryHandle — 插桩侧持有的 channel sender。
model
A Model that reports what the calls no turn made have cost.
perf
Perf — in-process lightweight performance metrics collector. Always running. Non-blocking. No external dependencies.
recorder
Recorder — records every LLM call and replays it deterministically.
redact
Redaction policy: what is replaced before telemetry events leave the process. Error messages are the only free text an event carries, so the policy is a single switch; sanitize_path is the helper for callers that keep a path but not the username in it.
spawn
Spawn telemetry pipeline — returns a handle and a background consumer future.