Expand description
OpenTelemetry tracing integration for distributed observability.
This module provides OpenTelemetry tracing capabilities for tracking operations across the CHIE protocol, enabling distributed tracing, performance analysis, and debugging in production environments.
§Features
- Span Management: Create and manage tracing spans
- Context Propagation: Propagate trace context across async boundaries
- Attribute Recording: Record custom attributes and events
- Multiple Exporters: Support for Jaeger, Zipkin, OTLP, and console
- Sampling: Configurable sampling strategies
- Performance: Low-overhead tracing with minimal impact
§Example
use chie_core::tracing::{TracingConfig, TracingManager, span_scope};
use std::time::Duration;
// Initialize tracing
let config = TracingConfig::default()
.with_service_name("chie-node")
.with_console_exporter(true);
let manager = TracingManager::new(config)?;
// Create a traced operation
{
let _guard = span_scope("store_chunk");
// Your operation here
std::thread::sleep(Duration::from_millis(10));
}
// Shutdown to flush remaining spans
manager.shutdown()?;Structs§
- Span
- Represents a tracing span for an operation.
- Span
Event - Represents an event within a span.
- Span
Guard - RAII guard for automatic span finish.
- Trace
Context - Trace context for propagating trace information.
- Tracing
Config - Configuration for OpenTelemetry tracing.
- Tracing
Manager - Tracing manager for initializing and managing OpenTelemetry.
- Tracing
Stats - Statistics for tracing operations.
Enums§
- Tracing
Error - Errors that can occur during tracing operations.
Functions§
- get_
tracing_ stats - Gets the global tracing statistics.
- reset_
tracing_ stats - Resets the global tracing statistics.
- span_
scope - Creates a new span with automatic finish on drop.
- span_
with_ attributes - Creates a span with attributes.