Skip to main content

SqliteBackend

Struct SqliteBackend 

Source
pub struct SqliteBackend { /* private fields */ }
Expand description

SQLite storage backend

Implementations§

Source§

impl SqliteBackend

Source

pub fn new(config: StorageConfig) -> Self

Create a new SQLite backend with the given configuration

Trait Implementations§

Source§

impl StorageBackend for SqliteBackend

Source§

fn initialize<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn write_log<'life0, 'life1, 'async_trait>( &'life0 self, log: &'life1 LogRecord, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn write_span<'life0, 'life1, 'async_trait>( &'life0 self, span: &'life1 Span, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn write_metric<'life0, 'life1, 'async_trait>( &'life0 self, metric: &'life1 Metric, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn query_logs<'life0, 'life1, 'async_trait>( &'life0 self, params: &'life1 QueryParams, ) -> Pin<Box<dyn Future<Output = Result<Vec<LogRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn query_spans<'life0, 'life1, 'async_trait>( &'life0 self, params: &'life1 QueryParams, ) -> Pin<Box<dyn Future<Output = Result<Vec<Span>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn query_spans_for_trace_list<'life0, 'life1, 'async_trait>( &'life0 self, params: &'life1 QueryParams, trace_limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Span>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Query all spans for the N most-recent distinct traces matching the filters.
Source§

fn query_metrics<'life0, 'life1, 'async_trait>( &'life0 self, params: &'life1 QueryParams, ) -> Pin<Box<dyn Future<Output = Result<Vec<Metric>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Query metrics (raw time-series rows, latest first).
Source§

fn query_latest_metrics<'life0, 'life1, 'async_trait>( &'life0 self, params: &'life1 QueryParams, ) -> Pin<Box<dyn Future<Output = Result<Vec<Metric>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Query metrics returning the single most-recent data point per unique name.
Source§

fn stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<StorageStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn purge<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 PurgeOptions, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn purge_all<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PurgeAllStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn distinct_resource_keys<'life0, 'life1, 'async_trait>( &'life0 self, signal: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return distinct resource attribute keys for the given signal type. signal must be one of "logs", "spans", or "metrics".
Source§

fn query_token_usage<'life0, 'life1, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, model: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<(TokenUsageSummary, Vec<ModelUsage>, Vec<SystemUsage>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn query_cost_series<'life0, 'life1, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, bucket_ns: i64, model: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<CostSeriesPoint>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Time-bucketed token usage grouped by model for cost-over-time analysis. Read more
Source§

fn query_top_spans<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, limit: usize, sort_by: TopSpanSort, truncated_only: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<TopSpan>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Top-N LLM spans ordered by the given sort dimension. Read more
Source§

fn query_top_sessions<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionCostRow>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Top-N sessions by total tokens, suitable for cost enrichment.
Source§

fn query_top_conversations<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<ConversationCostRow>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Top-N conversations (gen_ai.conversation.id) by total tokens.
Source§

fn query_finish_reasons<'life0, 'life1, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, model: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FinishReasonCount>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Finish-reason distribution across LLM spans and Claude Code api_response_body logs.
Source§

fn query_latency_stats<'life0, 'life1, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, model: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<LatencyStats>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Latency (and optional TTFT) percentile statistics per model for LLM spans.
Source§

fn query_error_rate<'life0, 'life1, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, model: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ErrorRateByModel>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Error rate by model across LLM spans.
Source§

fn query_tool_usage<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<ToolUsage>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Aggregated tool-execution usage counts and durations.
Source§

fn query_retry_stats<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<RetryStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retry statistics across LLM spans.
Source§

fn query_retrieval_stats<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, top_queries_limit: usize, ) -> Pin<Box<dyn Future<Output = Result<RetrievalStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Aggregated retrieval / RAG statistics across retriever spans.
Source§

fn query_truncation_rate<'life0, 'life1, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, model: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TruncationRateByModel>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Truncation rate (finish_reason = max_tokens / length) per model.
Source§

fn query_cache_hit_rate<'life0, 'life1, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, model: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<CacheHitRateByModel>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cache token hit rate per model.
Source§

fn query_request_param_profile<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<RequestParamProfile>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Distribution of request parameter settings (temperature, max_tokens).
Source§

fn query_conversation_depth<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<ConversationDepthStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Turn-count distribution across conversations with a known conversation_id.
Source§

fn query_calls_series<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, bucket_secs: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<CallsSeriesPoint>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

LLM call volume per time bucket (parallel to query_cost_series).
Source§

fn query_error_types<'life0, 'life1, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, model: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ErrorTypeBreakdown>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Per-(model, error_type) breakdown of error spans, bucketed into actionable categories.
Source§

fn query_model_drift<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ModelDriftPair>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

All observed (request_model, response_model) pairs with a differs flag.
Source§

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more