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.
Auto Trait Implementations§
impl Freeze for TelemetryRecorder
impl RefUnwindSafe for TelemetryRecorder
impl Send for TelemetryRecorder
impl Sync for TelemetryRecorder
impl Unpin for TelemetryRecorder
impl UnwindSafe for TelemetryRecorder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more