rs-zero 0.2.8

Rust-first microservice framework inspired by go-zero engineering practices
Documentation
//! Observability helpers for metrics and tracing.

pub mod cache;
pub mod config;
pub mod correlation;
pub mod metrics;
pub mod otel;
pub mod otlp;
#[cfg(feature = "observability-prometheus-client")]
pub mod prometheus_client;
pub mod redis;
pub mod resilience;
pub mod rest;
#[cfg(feature = "rpc")]
pub mod rpc;
pub mod sql;
pub mod trace;

pub use config::{MetricsConfig, ObservabilityConfig, OpenTelemetryConfig, TraceExporter};
pub use correlation::CorrelationContext;
pub use metrics::{
    CacheMetricLabels, HttpMetricLabels, MetricsRegistry, RedisDegradationLabels, RedisEventLabels,
    RedisMetricLabels, ResilienceMetricLabels, RpcMetricLabels, SqlMetricLabels,
};
pub use otel::{
    ObservabilityError, ObservabilityResult, init_opentelemetry_tracing,
    init_opentelemetry_tracing_with_handle,
};
#[cfg(feature = "otlp")]
pub use otlp::install_otlp_tracing;
pub use otlp::{OtlpProtocol, OtlpTraceConfig, TraceShutdownHandle, build_otlp_trace_config};
#[cfg(feature = "observability-prometheus-client")]
pub use prometheus_client::PrometheusClientMetricsRegistry;
pub use redis::{record_redis_command, record_redis_degradation, record_redis_event};
pub use resilience::record_resilience_decision;
pub use rest::{metrics_router, record_metrics_middleware};
#[cfg(feature = "rpc")]
pub use rpc::{
    observe_rpc_unary, observe_rpc_unary_with_context, observe_rpc_unary_with_metadata,
    record_rpc_streaming_snapshot,
};
pub use sql::observe_sql_query;
pub use trace::{
    CurrentRequestId, REQUEST_ID_HEADER, TRACEPARENT_HEADER, current_span_id, current_trace_id,
    current_traceparent, insert_traceparent_header, request_id_from_headers,
    span_id_from_traceparent, trace_id_from_traceparent, traceparent_from_headers,
};
#[cfg(all(feature = "otlp", feature = "rpc"))]
pub use trace::{
    inject_current_context_metadata, opentelemetry_context_from_metadata,
    set_span_parent_from_metadata,
};
#[cfg(feature = "rpc")]
pub use trace::{insert_traceparent_metadata, request_id_from_metadata, traceparent_from_metadata};
#[cfg(feature = "otlp")]
pub use trace::{
    opentelemetry_context_from_headers, opentelemetry_context_from_traceparent,
    set_span_parent_from_headers,
};