pub struct TelemetryKit { /* private fields */ }Expand description
Main telemetry SDK
Implementations§
Source§impl TelemetryKit
impl TelemetryKit
Sourcepub fn builder() -> TelemetryBuilder
pub fn builder() -> TelemetryBuilder
Create a new TelemetryKit builder
Sourcepub async fn track_command<F>(
&self,
command: impl Into<String>,
builder_fn: F,
) -> Result<()>
pub async fn track_command<F>( &self, command: impl Into<String>, builder_fn: F, ) -> Result<()>
Track a command execution
§Example
telemetry.track_command("build", |event| {
event
.flag("--release")
.duration_ms(1234)
.success(true)
}).await?;Sourcepub async fn track_feature<F>(
&self,
feature: impl Into<String>,
builder_fn: F,
) -> Result<()>
pub async fn track_feature<F>( &self, feature: impl Into<String>, builder_fn: F, ) -> Result<()>
Track a feature usage
§Example
telemetry.track_feature("authentication", |event| {
event
.method("oauth")
.success(true)
}).await?;Sourcepub async fn track_custom(
&self,
event_type: impl Into<String>,
data: Value,
) -> Result<()>
pub async fn track_custom( &self, event_type: impl Into<String>, data: Value, ) -> Result<()>
Track a custom event
Sourcepub fn grant_consent(&self) -> Result<()>
pub fn grant_consent(&self) -> Result<()>
Grant user consent for telemetry tracking
Sourcepub fn deny_consent(&self) -> Result<()>
pub fn deny_consent(&self) -> Result<()>
Deny user consent for telemetry tracking
Sourcepub fn is_do_not_track_enabled() -> bool
pub fn is_do_not_track_enabled() -> bool
Check if DO_NOT_TRACK environment variable is set
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TelemetryKit
impl !RefUnwindSafe for TelemetryKit
impl Send for TelemetryKit
impl Sync for TelemetryKit
impl Unpin for TelemetryKit
impl !UnwindSafe for TelemetryKit
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
Mutably borrows from an owned value. Read more