Skip to main content

StorageBackend

Trait StorageBackend 

Source
pub trait StorageBackend: Send + Sync {
Show 22 methods // Required methods 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; 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_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; 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; fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: '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; fn query_token_usage<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<(TokenUsageSummary, Vec<ModelUsage>, Vec<SystemUsage>)>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn query_cost_series<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, bucket_ns: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<CostSeriesPoint>>> + 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, ) -> Pin<Box<dyn Future<Output = Result<Vec<TopSpan>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn query_finish_reasons<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FinishReasonCount>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn query_latency_stats<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<LatencyStats>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn query_error_rate<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ErrorRateByModel>>> + 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; 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;
}
Expand description

Pluggable storage backend trait.

Both otelite-receiver (writes) and otelite-api (reads) depend only on this trait; neither needs a direct dependency on the SQLite implementation.

Required Methods§

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 close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + 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, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<(TokenUsageSummary, Vec<ModelUsage>, Vec<SystemUsage>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

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

Time-bucketed token usage grouped by model for cost-over-time analysis.

bucket_ns is the bucket size in nanoseconds (e.g. 3_600_000_000_000 for 1h).

Source

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

Top-N most expensive LLM spans by total tokens.

Source

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

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

Source

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

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

Source

fn query_error_rate<'life0, 'async_trait>( &'life0 self, start_time: Option<i64>, end_time: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ErrorRateByModel>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: '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.

Implementors§