Skip to main content

lc_observability/
lib.rs

1// lc-observability/src/lib.rs
2//! Pluggable observability sinks for LangChainRust.
3//!
4//! The framework exposes the [`MetricsSink`] interface and an [`ObsEvent`] payload
5//! from `lc-core` (written by `TokenTrackingLLM` and `AgentExecutor`). This crate
6//! ships concrete sinks that implement it:
7//!
8//! - [`JsonLinesSink`] (default `jsonl` feature): append each event as one JSON
9//!   line to a file.
10//! - MongoSink (`mongodb` feature): insert each event as a document.
11//!
12//! Export failures are returned as [`ObsError`]; the framework logs a `warn` and
13//! the main flow continues — sinks never interrupt the agent.
14
15mod jsonl;
16#[cfg(feature = "mongodb")]
17mod mongo;
18
19pub use jsonl::JsonLinesSink;
20#[cfg(feature = "mongodb")]
21pub use mongo::MongoSink;
22
23pub use lc_core::observability::{MetricsSink, ObsError, ObsEvent};