graphrt_otel/lib.rs
1//! # graphrt-otel
2//!
3//! OpenTelemetry for graphrt runs, without the OpenTelemetry SDK: an
4//! [`EventTracer`] turns run [`graphrt_core::Event`]s into spans (one per run,
5//! one per node execution, one per container body run) with GenAI semantic
6//! convention attributes, and exporters ship them as OTLP/HTTP JSON.
7//!
8//! ```no_run
9//! # async fn demo(graph: std::sync::Arc<graphrt_core::Graph>, mut run: graphrt_core::RunStream) {
10//! use std::sync::Arc;
11//! use futures::StreamExt;
12//! use graphrt_otel::{EventTracer, OtelConfig, OtlpHttpExporter};
13//!
14//! let config = OtelConfig::from_env().expect("valid OTEL_* variables");
15//! let exporter = Arc::new(OtlpHttpExporter::start(&config, None).expect("inside tokio"));
16//! let mut tracer = EventTracer::new(exporter.clone()).with_graph(graph);
17//! while let Some(event) = run.next().await {
18//! tracer.on_event(&event);
19//! }
20//! exporter.shutdown().await;
21//! # }
22//! ```
23//!
24//! Content (node outputs, progress payloads) is not recorded unless
25//! [`EventTracer::capture_content`] is enabled; secrets are always masked.
26
27pub mod config;
28pub mod exporter;
29#[cfg(feature = "http")]
30pub mod http;
31pub mod metrics;
32pub mod otlp;
33pub mod span;
34pub mod tracer;
35
36pub use config::{ConfigError, OtelConfig};
37pub use exporter::{InMemoryExporter, MultiExporter, SpanExporter, StdoutExporter, WriterExporter};
38#[cfg(feature = "http")]
39pub use http::{ExportError, OtlpHttpExporter};
40pub use metrics::Metrics;
41pub use otlp::Resource;
42pub use span::{AttrValue, Span, SpanId, StatusCode, TraceId, TraceParent};
43pub use tracer::EventTracer;