pub struct TraceStore { /* private fields */ }Expand description
In-memory ring buffer for execution traces.
Implementations§
Source§impl TraceStore
impl TraceStore
Sourcepub fn new(config: TraceStoreConfig) -> Self
pub fn new(config: TraceStoreConfig) -> Self
Create a new trace store.
Sourcepub fn record(&mut self, trace: TraceEntry) -> u64
pub fn record(&mut self, trace: TraceEntry) -> u64
Record a new trace. Returns the assigned trace ID.
Sourcepub fn reserve_id(&mut self) -> u64
pub fn reserve_id(&mut self) -> u64
§Fase 33.c — Reserve a trace ID without recording the entry yet.
Wire-streaming sites (execute_sse_handler) need a trace ID up
front so the first axon.token event can carry it on the wire
— adopters bind the live stream to the eventual replay surface
via this id. The entry is finalized via record_with_id once
the executor closes the FlowExecutionEvent channel.
When the store is disabled the call still returns 0 to match
record’s disabled-path semantics.
Sourcepub fn record_with_id(&mut self, trace: TraceEntry, id: u64)
pub fn record_with_id(&mut self, trace: TraceEntry, id: u64)
§Fase 33.c — Persist a trace entry under a previously reserved id.
Pairs with reserve_id: callers reserve early to plumb the id
into wire events, then call here once execution has completed
with final stats. The capacity / eviction / timestamp semantics
match record verbatim — only the id-allocation timing differs.
Sourcepub fn get(&self, id: u64) -> Option<&TraceEntry>
pub fn get(&self, id: u64) -> Option<&TraceEntry>
Get a trace by ID.
Sourcepub fn recent(
&self,
limit: usize,
filter: Option<&TraceFilter>,
) -> Vec<&TraceEntry>
pub fn recent( &self, limit: usize, filter: Option<&TraceFilter>, ) -> Vec<&TraceEntry>
Query recent traces (newest first), optionally filtered.
Sourcepub fn total_recorded(&self) -> u64
pub fn total_recorded(&self) -> u64
Total traces recorded (including evicted).
Sourcepub fn get_mut(&mut self, id: u64) -> Option<&mut TraceEntry>
pub fn get_mut(&mut self, id: u64) -> Option<&mut TraceEntry>
Get a mutable trace by ID (for annotations).
Sourcepub fn annotate(&mut self, id: u64, annotation: TraceAnnotation) -> bool
pub fn annotate(&mut self, id: u64, annotation: TraceAnnotation) -> bool
Annotate a trace by ID. Returns true if the trace was found.
Sourcepub fn bulk_delete(&mut self, ids: &[u64]) -> usize
pub fn bulk_delete(&mut self, ids: &[u64]) -> usize
Bulk delete traces by IDs. Returns number actually deleted.
Sourcepub fn bulk_annotate(
&mut self,
ids: &[u64],
annotation: TraceAnnotation,
) -> usize
pub fn bulk_annotate( &mut self, ids: &[u64], annotation: TraceAnnotation, ) -> usize
Bulk annotate traces by IDs. Returns number of traces annotated.
Sourcepub fn search(&self, query: &str, limit: usize) -> Vec<&TraceEntry>
pub fn search(&self, query: &str, limit: usize) -> Vec<&TraceEntry>
Full-text search across buffered traces.
Matches the query (case-insensitive substring) against: flow_name, source_file, backend, client_key, event step_name, event detail, annotation text, and annotation tags.
Sourcepub fn evict_expired(&mut self) -> usize
pub fn evict_expired(&mut self) -> usize
Evict traces older than max_age_secs. Returns number evicted.
No-op if max_age_secs is 0.
Sourcepub fn set_max_age_secs(&mut self, max_age_secs: u64) -> u64
pub fn set_max_age_secs(&mut self, max_age_secs: u64) -> u64
Update retention policy. Returns previous max_age_secs.
Sourcepub fn config(&self) -> &TraceStoreConfig
pub fn config(&self) -> &TraceStoreConfig
Get configuration.
Sourcepub fn stats(&self) -> TraceStoreStats
pub fn stats(&self) -> TraceStoreStats
Compute aggregate statistics across buffered traces.
Sourcepub fn aggregate(&self, window_secs: u64) -> TraceAggregate
pub fn aggregate(&self, window_secs: u64) -> TraceAggregate
Aggregate traces within a time window (seconds from now). Returns percentiles, error rate, and per-flow stats. If window_secs is 0, aggregates all buffered traces.
Sourcepub fn set_correlation(&mut self, id: u64, correlation_id: &str) -> bool
pub fn set_correlation(&mut self, id: u64, correlation_id: &str) -> bool
Set correlation ID on a trace. Returns true if found.
Sourcepub fn by_correlation(&self, correlation_id: &str) -> Vec<&TraceEntry>
pub fn by_correlation(&self, correlation_id: &str) -> Vec<&TraceEntry>
Find all traces with a given correlation ID.
Auto Trait Implementations§
impl Freeze for TraceStore
impl RefUnwindSafe for TraceStore
impl Send for TraceStore
impl Sync for TraceStore
impl Unpin for TraceStore
impl UnsafeUnpin for TraceStore
impl UnwindSafe for TraceStore
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
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>
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>
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