pub struct TracingGraphObserver { /* private fields */ }Expand description
Observer that records graph execution traces and spans.
Can be used manually or integrated with the streaming system to automatically capture graph runs and node executions.
Implementations§
Source§impl TracingGraphObserver
impl TracingGraphObserver
pub fn new(store: Arc<dyn TracingStore>, event_bus: EventBus) -> Self
Sourcepub fn on_graph_start(&mut self, name: &str, input: JsonValue) -> String
pub fn on_graph_start(&mut self, name: &str, input: JsonValue) -> String
Start observing a new graph run
Sourcepub fn on_graph_end(
&self,
trace_id: &str,
output: JsonValue,
status: TraceStatus,
)
pub fn on_graph_end( &self, trace_id: &str, output: JsonValue, status: TraceStatus, )
Record graph run completion
Sourcepub fn on_node_start(
&self,
trace_id: &str,
parent_span_id: Option<&str>,
node_name: &str,
input: JsonValue,
) -> String
pub fn on_node_start( &self, trace_id: &str, parent_span_id: Option<&str>, node_name: &str, input: JsonValue, ) -> String
Start a node execution span
Sourcepub fn on_node_end(
&self,
span_id: &str,
trace_id: &str,
output: JsonValue,
success: bool,
)
pub fn on_node_end( &self, span_id: &str, trace_id: &str, output: JsonValue, success: bool, )
Record node execution completion
Sourcepub fn on_llm_start(
&self,
trace_id: &str,
parent_span_id: Option<&str>,
model: &str,
input: JsonValue,
) -> String
pub fn on_llm_start( &self, trace_id: &str, parent_span_id: Option<&str>, model: &str, input: JsonValue, ) -> String
Record an LLM generation span
Sourcepub fn on_llm_end(
&self,
span_id: &str,
trace_id: &str,
output: JsonValue,
success: bool,
tokens_in: Option<u32>,
tokens_out: Option<u32>,
)
pub fn on_llm_end( &self, span_id: &str, trace_id: &str, output: JsonValue, success: bool, tokens_in: Option<u32>, tokens_out: Option<u32>, )
Record LLM generation completion with token usage
Sourcepub fn on_tool_start(
&self,
trace_id: &str,
parent_span_id: Option<&str>,
tool_name: &str,
input: JsonValue,
) -> String
pub fn on_tool_start( &self, trace_id: &str, parent_span_id: Option<&str>, tool_name: &str, input: JsonValue, ) -> String
Record a tool call span
Sourcepub fn on_tool_end(
&self,
span_id: &str,
trace_id: &str,
output: JsonValue,
success: bool,
)
pub fn on_tool_end( &self, span_id: &str, trace_id: &str, output: JsonValue, success: bool, )
Record tool call completion
pub fn store(&self) -> &dyn TracingStore
pub fn event_bus(&self) -> &EventBus
Auto Trait Implementations§
impl !RefUnwindSafe for TracingGraphObserver
impl !UnwindSafe for TracingGraphObserver
impl Freeze for TracingGraphObserver
impl Send for TracingGraphObserver
impl Sync for TracingGraphObserver
impl Unpin for TracingGraphObserver
impl UnsafeUnpin for TracingGraphObserver
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