pub mod context;
pub mod distributed;
pub mod exporter;
pub mod sampler;
pub mod span;
use opentelemetry::global;
use opentelemetry::global::BoxedTracer;
pub use distributed::{
AdaptiveSampler, AlwaysOffSampler, AlwaysOnSampler, B3TraceContext, BaggageItem,
BaggageManager, BaggageMetadata, BufferedSpan, ContextPropagator, DistributedTraceManager,
ExtractedContext, GeospatialAttributes, GeospatialSpanBuilder, HeadBasedSampler,
InjectionContext, JaegerTraceContext, OtelHeaderExtractor, OtelHeaderInjector,
ParentBasedSampler, PropagationFormat, Sampler, SamplingDecision, SamplingResult, SpanEvent,
SpanHandle, TailBasedSampler, TraceBuffer, TraceHandle, TraceStats, W3CTraceContext,
};
pub use distributed::{extract_otel_context, inject_otel_context};
pub struct TracingManager {
service_name: String,
}
impl TracingManager {
pub fn new(service_name: String) -> Self {
Self { service_name }
}
pub fn get_tracer(&self) -> BoxedTracer {
global::tracer(self.service_name.clone())
}
pub fn service_name(&self) -> &str {
&self.service_name
}
pub fn distributed_manager(&self) -> DistributedTraceManager {
DistributedTraceManager::new(&self.service_name)
}
}