Skip to main content

telemetry/
lib.rs

1//! Telemetry — structured event recording with pluggable, callback-based export.
2//!
3//! This crate never talks to the network itself: it only defines the event
4//! schema, applies per-event-kind filtering and redaction, and hands
5//! surviving events to whatever [`TelemetryRecorder`] callbacks the caller
6//! passes to [`spawn`]. Where events actually end up (a file, an HTTP
7//! endpoint, an OTLP collector, …) is entirely the caller's decision — see
8//! `daemon::telemetry_otel` for the OTLP recorder this workspace ships.
9//!
10//! Default: noop (zero overhead) when disabled or given no recorders.
11//! Events are dropped silently if the channel is full — telemetry never
12//! blocks the agent.
13
14pub mod config;
15pub mod events;
16pub mod file_recorder;
17pub mod handle;
18pub mod perf;
19pub mod recorder;
20pub mod redact;
21pub mod spawn;
22
23pub use config::{TelemetryConfig, TelemetryMode};
24pub use events::{
25    AgentCompletedPayload, AgentSpawnedPayload, ApiErrorPayload, ApiRequestPayload,
26    BudgetEnforcedAction, BudgetEnforcedPayload, CompactActionPayload, CompactKind, EventPayload,
27    HookRunPayload, McpConnectionErrorPayload, McpServerConnectedPayload,
28    PermissionDecisionOutcome, PermissionDecisionPayload, ProviderSwitchedPayload,
29    ResumeActionPayload, ResumeOutcome, SessionEndPayload, SessionStartPayload,
30    SlashCommandUsedPayload, StartupTimingPayload, TeamStageCompletePayload, TelemetryEvent,
31    ToolCancelledPayload, ToolExecutionPayload, ToolOutcome, ToolStartPayload, TurnCompletePayload,
32    TurnStartPayload, UserPromptSubmitPayload,
33};
34pub use file_recorder::FileRecorder;
35pub use handle::{
36    EventFilter, NoopHandle, TelemetryHandle, TelemetryHandleError, TelemetryRecorder,
37};
38pub use redact::{Redact, RedactionPolicy};
39pub use spawn::{spawn, SpawnError, TelemetryConsumer};