pub struct TraceStore<C: ConnectionTrait> { /* private fields */ }Expand description
Interface for trace storage
Implementations§
Source§impl<C: ConnectionTrait> TraceStore<C>
impl<C: ConnectionTrait> TraceStore<C>
Sourcepub fn with_sampling(conn: C, sample_rate: f64) -> Self
pub fn with_sampling(conn: C, sample_rate: f64) -> Self
Create with sampling
Sourcepub fn start_run(
&self,
name: impl Into<String>,
resource: HashMap<String, String>,
) -> Result<TraceRun>
pub fn start_run( &self, name: impl Into<String>, resource: HashMap<String, String>, ) -> Result<TraceRun>
Start a new trace run
Sourcepub fn update_run_metrics(
&self,
trace_id: &TraceId,
tokens: u64,
cost_millicents: u64,
) -> Result<()>
pub fn update_run_metrics( &self, trace_id: &TraceId, tokens: u64, cost_millicents: u64, ) -> Result<()>
Update run metrics
Sourcepub fn start_span(
&self,
trace_id: &TraceId,
name: impl Into<String>,
parent_span_id: Option<SpanId>,
kind: SpanKind,
) -> Result<TraceSpan>
pub fn start_span( &self, trace_id: &TraceId, name: impl Into<String>, parent_span_id: Option<SpanId>, kind: SpanKind, ) -> Result<TraceSpan>
Start a new span
Sourcepub fn end_span(
&self,
trace_id: &TraceId,
span_id: &SpanId,
status: SpanStatusCode,
message: Option<String>,
) -> Result<()>
pub fn end_span( &self, trace_id: &TraceId, span_id: &SpanId, status: SpanStatusCode, message: Option<String>, ) -> Result<()>
End a span
Sourcepub fn add_span_event(
&self,
trace_id: &TraceId,
span_id: &SpanId,
name: impl Into<String>,
attributes: HashMap<String, TraceValue>,
) -> Result<()>
pub fn add_span_event( &self, trace_id: &TraceId, span_id: &SpanId, name: impl Into<String>, attributes: HashMap<String, TraceValue>, ) -> Result<()>
Add an event to a span
Sourcepub fn set_span_attributes(
&self,
trace_id: &TraceId,
span_id: &SpanId,
attributes: HashMap<String, TraceValue>,
) -> Result<()>
pub fn set_span_attributes( &self, trace_id: &TraceId, span_id: &SpanId, attributes: HashMap<String, TraceValue>, ) -> Result<()>
Set span attributes
Sourcepub fn get_spans(&self, trace_id: &TraceId) -> Result<Vec<TraceSpan>>
pub fn get_spans(&self, trace_id: &TraceId) -> Result<Vec<TraceSpan>>
Get all spans for a trace
Sourcepub fn log_retrieval_hit(
&self,
trace_id: &TraceId,
span_id: &SpanId,
hit: RetrievalHitEvent,
) -> Result<()>
pub fn log_retrieval_hit( &self, trace_id: &TraceId, span_id: &SpanId, hit: RetrievalHitEvent, ) -> Result<()>
Log a retrieval hit
Sourcepub fn log_tool_call(
&self,
trace_id: &TraceId,
span_id: &SpanId,
call: ToolCallEvent,
) -> Result<()>
pub fn log_tool_call( &self, trace_id: &TraceId, span_id: &SpanId, call: ToolCallEvent, ) -> Result<()>
Log a tool call
Sourcepub fn log_context_packaging(
&self,
trace_id: &TraceId,
span_id: &SpanId,
event: ContextPackagingEvent,
) -> Result<()>
pub fn log_context_packaging( &self, trace_id: &TraceId, span_id: &SpanId, event: ContextPackagingEvent, ) -> Result<()>
Log context packaging
Auto Trait Implementations§
impl<C> Freeze for TraceStore<C>where
C: Freeze,
impl<C> RefUnwindSafe for TraceStore<C>where
C: RefUnwindSafe,
impl<C> Send for TraceStore<C>where
C: Send,
impl<C> Sync for TraceStore<C>where
C: Sync,
impl<C> Unpin for TraceStore<C>where
C: Unpin,
impl<C> UnwindSafe for TraceStore<C>where
C: UnwindSafe,
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