pub struct TelemetryStorage { /* private fields */ }Expand description
Telemetry storage backend using SQLite
Implementations§
Source§impl TelemetryStorage
impl TelemetryStorage
Sourcepub async fn new(db_path: &Path) -> TelemetryResult<Self>
pub async fn new(db_path: &Path) -> TelemetryResult<Self>
Create a new storage backend
Sourcepub async fn initialize_default() -> TelemetryResult<Self>
pub async fn initialize_default() -> TelemetryResult<Self>
Initialize with default configuration
Uses ~/.local/share/reasonkit/.rk_telemetry.db on Linux/Mac
or the appropriate XDG data directory.
Sourcepub fn in_memory() -> TelemetryResult<Self>
pub fn in_memory() -> TelemetryResult<Self>
Create an in-memory storage (for testing)
Sourcepub fn schema_version(&self) -> TelemetryResult<u32>
pub fn schema_version(&self) -> TelemetryResult<u32>
Get current schema version
Sourcepub async fn insert_session(&mut self, session_id: Uuid) -> TelemetryResult<()>
pub async fn insert_session(&mut self, session_id: Uuid) -> TelemetryResult<()>
Insert a session record (required before inserting traces/queries)
Sourcepub async fn insert_query_event(
&mut self,
event: &QueryEvent,
) -> TelemetryResult<()>
pub async fn insert_query_event( &mut self, event: &QueryEvent, ) -> TelemetryResult<()>
Insert a query event
Sourcepub async fn insert_feedback_event(
&mut self,
event: &FeedbackEvent,
) -> TelemetryResult<()>
pub async fn insert_feedback_event( &mut self, event: &FeedbackEvent, ) -> TelemetryResult<()>
Insert a feedback event
Sourcepub async fn insert_trace_event(
&mut self,
event: &TraceEvent,
) -> TelemetryResult<()>
pub async fn insert_trace_event( &mut self, event: &TraceEvent, ) -> TelemetryResult<()>
Insert a trace event
Sourcepub async fn get_aggregated_metrics(&self) -> TelemetryResult<AggregatedMetrics>
pub async fn get_aggregated_metrics(&self) -> TelemetryResult<AggregatedMetrics>
Get aggregated metrics
Sourcepub async fn export_anonymized(&self) -> TelemetryResult<CommunityExport>
pub async fn export_anonymized(&self) -> TelemetryResult<CommunityExport>
Export anonymized data for community contribution
Sourcepub async fn run_daily_aggregation(&mut self, date: &str) -> TelemetryResult<()>
pub async fn run_daily_aggregation(&mut self, date: &str) -> TelemetryResult<()>
Run daily aggregation
Sourcepub async fn get_db_size(&self) -> TelemetryResult<u64>
pub async fn get_db_size(&self) -> TelemetryResult<u64>
Get database size in bytes
Sourcepub async fn prune_old_data(
&mut self,
retention_days: u32,
) -> TelemetryResult<u64>
pub async fn prune_old_data( &mut self, retention_days: u32, ) -> TelemetryResult<u64>
Prune old data based on retention policy
Sourcepub async fn vacuum(&mut self) -> TelemetryResult<()>
pub async fn vacuum(&mut self) -> TelemetryResult<()>
Vacuum database to reclaim space
Sourcepub async fn get_query_count(&self) -> TelemetryResult<u64>
pub async fn get_query_count(&self) -> TelemetryResult<u64>
Get query count
Auto Trait Implementations§
impl !Freeze for TelemetryStorage
impl RefUnwindSafe for TelemetryStorage
impl Send for TelemetryStorage
impl Sync for TelemetryStorage
impl Unpin for TelemetryStorage
impl UnwindSafe for TelemetryStorage
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