Skip to main content

TracingCollector

Struct TracingCollector 

Source
pub struct TracingCollector { /* private fields */ }

Implementations§

Source§

impl TracingCollector

Source

pub fn new( output_dir: &Path, service_name: impl Into<String>, redact: bool, trace_tx: Option<UnboundedSender<TraceEvent>>, ) -> Result<Self>

Create a new collector.

§Errors

Returns an error if output_dir cannot be created.

Source

pub fn begin_iteration(&mut self, index: usize, user_msg_preview: &str)

Open an iteration span. Call at the start of process_user_message.

Source

pub fn end_iteration(&mut self, index: usize, status: SpanStatus)

Close an iteration span.

Source

pub fn begin_llm_request(&self, iteration_span_id: [u8; 8]) -> SpanGuard

Open an LLM request span. Returns an owned SpanGuard safe to hold across .await.

Source

pub fn end_llm_request(&mut self, guard: SpanGuard, attrs: &LlmAttributes)

Close an LLM request span.

Source

pub fn begin_tool_call( &self, tool_name: &str, iteration_span_id: [u8; 8], ) -> SpanGuard

Open a tool call span, recording the start time as now.

Source

pub fn begin_tool_call_at( &self, tool_name: &str, iteration_span_id: [u8; 8], started_at: &Instant, ) -> SpanGuard

Open a tool call span with a pre-recorded start time.

Use this variant when the tool has already executed (post-hoc assembly pattern) and started_at was captured before the call. The Unix start timestamp is back-computed from started_at.elapsed() so the span is correctly positioned on the timeline.

Source

pub fn end_tool_call( &mut self, guard: SpanGuard, tool_name: &str, attrs: ToolAttributes, )

Close a tool call span.

Open a memory search span.

Close a memory search span.

Source

pub fn trace_json_path(&self) -> PathBuf

Return the path to the trace.json file that will be written on finish().

Source

pub fn current_iteration_span_id(&self, index: usize) -> Option<[u8; 8]>

Return the span ID of the currently active iteration, if any.

Source

pub fn session_span_id(&self) -> [u8; 8]

Return the session root span ID (fallback parent when no iteration is active).

Source

pub fn trace_id(&self) -> [u8; 16]

Return the trace ID for this session.

Source

pub fn finish(&mut self)

Finalize the session span and write trace.json.

Safe to call multiple times — subsequent calls after the first are no-ops. Also sends spans over the OTel channel when the otel feature is enabled (C-05).

Trait Implementations§

Source§

impl Drop for TracingCollector

Source§

fn drop(&mut self)

Executes the destructor for this 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> 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<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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