Skip to main content

TraceStore

Struct TraceStore 

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

In-memory ring buffer for execution traces.

Implementations§

Source§

impl TraceStore

Source

pub fn new(config: TraceStoreConfig) -> Self

Create a new trace store.

Source

pub fn record(&mut self, trace: TraceEntry) -> u64

Record a new trace. Returns the assigned trace ID.

Source

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.

Source

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.

Source

pub fn get(&self, id: u64) -> Option<&TraceEntry>

Get a trace by ID.

Source

pub fn recent( &self, limit: usize, filter: Option<&TraceFilter>, ) -> Vec<&TraceEntry>

Query recent traces (newest first), optionally filtered.

Source

pub fn len(&self) -> usize

Number of buffered traces.

Source

pub fn is_empty(&self) -> bool

Whether the buffer is empty.

Source

pub fn total_recorded(&self) -> u64

Total traces recorded (including evicted).

Source

pub fn get_mut(&mut self, id: u64) -> Option<&mut TraceEntry>

Get a mutable trace by ID (for annotations).

Source

pub fn annotate(&mut self, id: u64, annotation: TraceAnnotation) -> bool

Annotate a trace by ID. Returns true if the trace was found.

Source

pub fn bulk_delete(&mut self, ids: &[u64]) -> usize

Bulk delete traces by IDs. Returns number actually deleted.

Source

pub fn bulk_annotate( &mut self, ids: &[u64], annotation: TraceAnnotation, ) -> usize

Bulk annotate traces by IDs. Returns number of traces annotated.

Source

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.

Source

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.

Source

pub fn set_max_age_secs(&mut self, max_age_secs: u64) -> u64

Update retention policy. Returns previous max_age_secs.

Source

pub fn config(&self) -> &TraceStoreConfig

Get configuration.

Source

pub fn stats(&self) -> TraceStoreStats

Compute aggregate statistics across buffered traces.

Source

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.

Source

pub fn set_correlation(&mut self, id: u64, correlation_id: &str) -> bool

Set correlation ID on a trace. Returns true if found.

Source

pub fn by_correlation(&self, correlation_id: &str) -> Vec<&TraceEntry>

Find all traces with a given correlation ID.

Source

pub fn clear(&mut self)

Clear all buffered traces.

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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