pub struct TelemetryStore { /* private fields */ }Expand description
Storage for telemetry records (JSONL file for easy streaming/appending)
Implementations§
Source§impl TelemetryStore
impl TelemetryStore
Sourcepub fn records_path() -> Result<PathBuf>
pub fn records_path() -> Result<PathBuf>
Get path to the telemetry records file
Sourcepub fn record(
&self,
category: &str,
event: &str,
data: HashMap<String, Value>,
tags: Vec<String>,
context: Option<String>,
) -> Result<TelemetryRecord>
pub fn record( &self, category: &str, event: &str, data: HashMap<String, Value>, tags: Vec<String>, context: Option<String>, ) -> Result<TelemetryRecord>
Record a new telemetry event
Sourcepub fn read_records(
&self,
category: Option<&str>,
event: Option<&str>,
tag: Option<&str>,
after: Option<i64>,
before: Option<i64>,
limit: Option<usize>,
) -> Result<Vec<TelemetryRecord>>
pub fn read_records( &self, category: Option<&str>, event: Option<&str>, tag: Option<&str>, after: Option<i64>, before: Option<i64>, limit: Option<usize>, ) -> Result<Vec<TelemetryRecord>>
Read all records, optionally filtered
Sourcepub fn count_records(&self) -> Result<usize>
pub fn count_records(&self) -> Result<usize>
Get record count
Sourcepub fn clear_records(&self, older_than_days: Option<u32>) -> Result<usize>
pub fn clear_records(&self, older_than_days: Option<u32>) -> Result<usize>
Clear records (optionally older than N days)
Sourcepub fn export_records(
&self,
output_path: &str,
format: &str,
category: Option<&str>,
with_metadata: bool,
) -> Result<usize>
pub fn export_records( &self, output_path: &str, format: &str, category: Option<&str>, with_metadata: bool, ) -> Result<usize>
Export records to a file
Sourcepub fn installation_id(&self) -> &str
pub fn installation_id(&self) -> &str
Get installation ID
Sourcepub fn sync_to_remote(&self, limit: Option<usize>) -> Result<SyncResult>
pub fn sync_to_remote(&self, limit: Option<usize>) -> Result<SyncResult>
Sync records to remote endpoint
Sourcepub fn config(&self) -> &TelemetryConfig
pub fn config(&self) -> &TelemetryConfig
Get the config
Auto Trait Implementations§
impl Freeze for TelemetryStore
impl RefUnwindSafe for TelemetryStore
impl Send for TelemetryStore
impl Sync for TelemetryStore
impl Unpin for TelemetryStore
impl UnwindSafe for TelemetryStore
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
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>
Converts
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>
Converts
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