pub struct TelemetryRecorder { /* private fields */ }Expand description
Telemetry recorder for tracking command execution.
Use TelemetryRecorder::new() at the start of command execution,
then call finish() when the command completes.
Implementations§
Source§impl TelemetryRecorder
impl TelemetryRecorder
Sourcepub fn with_start_time(
project_id: Option<&str>,
telemetry_enabled: bool,
info: TelemetryInfo,
start_time: Instant,
) -> Self
pub fn with_start_time( project_id: Option<&str>, telemetry_enabled: bool, info: TelemetryInfo, start_time: Instant, ) -> Self
Create a new telemetry recorder with a pre-recorded start time.
Use this when you need to start timing before you have all the telemetry configuration (e.g., before loading config from disk).
Checks opt-out settings in priority order:
DO_NOT_TRACKenv var -> Disabletelemetry_enabled = false-> Disable- Otherwise -> Enable
If no project_id is provided, generates an ephemeral UUID for this session.
Sourcepub fn new(
project_id: Option<&str>,
telemetry_enabled: bool,
info: TelemetryInfo,
) -> Self
pub fn new( project_id: Option<&str>, telemetry_enabled: bool, info: TelemetryInfo, ) -> Self
Create a new telemetry recorder, starting the timer now.
Checks opt-out settings in priority order:
DO_NOT_TRACKenv var -> Disabletelemetry_enabled = false-> Disable- Otherwise -> Enable
If no project_id is provided, generates an ephemeral UUID for this session.
Sourcepub fn finish(self, status: CommandStatus, error_kind: Option<&str>)
pub fn finish(self, status: CommandStatus, error_kind: Option<&str>)
Finish recording and spawn a detached child process to send telemetry.
This method consumes the recorder and spawns a background process. The main process can exit immediately without waiting.