pub struct SqliteBackend { /* private fields */ }Expand description
SQLite storage backend
Implementations§
Source§impl SqliteBackend
impl SqliteBackend
Sourcepub fn new(config: StorageConfig) -> Self
pub fn new(config: StorageConfig) -> Self
Create a new SQLite backend with the given configuration
Trait Implementations§
Source§impl StorageBackend for SqliteBackend
impl StorageBackend for SqliteBackend
fn initialize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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,
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,
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,
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,
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,
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,
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,
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.
fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<StorageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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,
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,
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".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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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.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§
impl Freeze for SqliteBackend
impl !RefUnwindSafe for SqliteBackend
impl Send for SqliteBackend
impl Sync for SqliteBackend
impl Unpin for SqliteBackend
impl UnsafeUnpin for SqliteBackend
impl !UnwindSafe for SqliteBackend
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