Skip to main content

EventLog

Struct EventLog 

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

Append-only event log with optional JSONL journal.

Implementations§

Source§

impl EventLog

Source

pub fn new() -> Self

Source

pub fn with_journal(path: PathBuf) -> Self

Source

pub fn append( &mut self, kind: EventKind, action_id: Option<&str>, proposal_id: Option<&str>, data: HashMap<String, Value>, ) -> &Event

Source

pub fn events(&self) -> &[Event]

Source

pub fn len(&self) -> usize

Source

pub fn span_len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn stats(&self) -> EventLogStats

Source

pub fn truncate_events_keep_last(&mut self, keep_last: usize) -> usize

Source

pub fn truncate_spans_keep_last(&mut self, keep_last: usize) -> usize

Source

pub fn clear(&mut self) -> EventLogStats

Source

pub fn filter( &self, kind: Option<&EventKind>, action_id: Option<&str>, ) -> Vec<&Event>

Source

pub fn begin_span( &mut self, name: &str, trace_id: &str, parent_span_id: Option<&str>, attributes: HashMap<String, Value>, ) -> String

Begin a new trace span. Returns the generated span_id.

Source

pub fn end_span(&mut self, span_id: &str, status: SpanStatus)

End an open span by setting its status and end time.

Source

pub fn spans(&self) -> Vec<Span>

Return all spans.

Source

pub fn export_traces(&self) -> String

Export traces as OTLP-compatible JSON.

Source

pub fn load(path: &Path) -> Result<Self>

Load an event log from a JSONL journal file.

Trait Implementations§

Source§

impl Default for EventLog

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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, 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, 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.