Expand description
OpenTelemetry integration and tracing for Juncture applications
This crate provides instrumentation capabilities for Juncture graph execution, including structured logging, span management, and metrics collection.
§Feature Flags
otel(default: off) - Enable OpenTelemetry trace/metrics export configuration
§Basic Usage
Initialize tracing for your Juncture application:
use juncture_tracing::init_tracing;
let _ = init_tracing();
// Your application code here§With OpenTelemetry
When the otel feature is enabled, you can configure OTLP export:
ⓘ
use juncture_tracing::{init, config::TracingConfig};
use tracing::Level;
init()
.with_service_name("my-agent-service")
.with_log_level(Level::INFO)
.install()?;§Span Constants
Use the provided span and attribute constants for consistency:
use juncture_tracing::{spans::names, spans::attrs};
assert_eq!(names::GRAPH_INVOKE, "juncture.graph.invoke");
assert_eq!(attrs::NODE_NAME, "juncture.node.name");§Distributed Trace Propagation
Use the propagation module for W3C TraceContext injection/extraction:
ⓘ
use juncture_tracing::propagation::{inject_trace_context, extract_trace_context};
use std::collections::HashMap;
// Inject before crossing process boundaries
let mut carrier = HashMap::new();
inject_trace_context(&mut carrier);
// Extract on the receiving side
let ctx = extract_trace_context(&carrier);Re-exports§
pub use callback::CallbackHandlerAdapter;pub use callback::GraphCallbackHandler;pub use callback::GraphInterruptEvent;pub use callback::GraphResumeEvent;pub use test_utils::TestMetricsCollector;pub use types::LlmCacheKeyInput;pub use types::LlmCachePolicy;pub use types::ServerInfo;pub use spans::attrs;pub use spans::names;
Modules§
- callback
- Graph lifecycle callback trait and events
- spans
- Span name and attribute constants for Juncture tracing
- test_
utils - Test utilities for metrics and tracing
- types
- Types for server metadata and LLM caching policies
Functions§
- init_
tracing - Initialize basic tracing without OpenTelemetry