Expand description
Pluggable observability sinks for LangChainRust.
The framework exposes the MetricsSink interface and an ObsEvent payload
from lc-core (written by TokenTrackingLLM and AgentExecutor). This crate
ships concrete sinks that implement it:
JsonLinesSink(defaultjsonlfeature): append each event as one JSON line to a file.MongoSink(mongodbfeature): insert each event as a document.
Export failures are returned as ObsError; the framework logs a warn and
the main flow continues — sinks never interrupt the agent.
Structs§
- Json
Lines Sink - Appends each event as a single JSON line to a file (one record per line —
tail-able,
jq-parseable, replayable). The file is opened once in append mode at construction, so concurrent exports serialize through the mutex. - Mongo
Sink - Inserts each event as one document into the given collection. Records keep the
serde tag (
"kind"), so a single collection can hold token-usage and agent metrics side by side.
Enums§
- ObsError
- Export error. Implementations surface failures through this and the framework
layer only logs a
warn— it never propagates into the main flow. - ObsEvent
- One observability record (the unified export payload).
Traits§
- Metrics
Sink - Pluggable observability sink. The framework only provides the interface and binds no concrete plugin.