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 model;
19pub mod perf;
20pub mod recorder;
21pub mod redact;
22pub mod spawn;
23
24pub use config::{TelemetryConfig, TelemetryMode};
25pub use events::{
26    AgentCompletedPayload, AgentSpawnedPayload, ApiErrorPayload, ApiRequestPayload,
27    BudgetEnforcedAction, BudgetEnforcedPayload, CompactActionPayload, CompactKind, EventPayload,
28    HookRunPayload, McpConnectionErrorPayload, McpServerConnectedPayload,
29    PermissionDecisionOutcome, PermissionDecisionPayload, ProviderSwitchedPayload,
30    ResumeActionPayload, ResumeOutcome, SessionEndPayload, SessionStartPayload,
31    SlashCommandUsedPayload, StartupTimingPayload, TeamStageCompletePayload, TelemetryEvent,
32    ToolCancelledPayload, ToolExecutionPayload, ToolOutcome, ToolStartPayload, TurnCompletePayload,
33    TurnStartPayload, UserPromptSubmitPayload,
34};
35pub use file_recorder::FileRecorder;
36pub use handle::{
37    EventFilter, NoopHandle, TelemetryHandle, TelemetryHandleError, TelemetryRecorder,
38};
39pub use redact::RedactionPolicy;
40pub use spawn::{spawn, SpawnError, TelemetryConsumer};