Skip to content

Commit

Permalink
sdk: expose Tracer::id_generator() (#1934)
Browse files Browse the repository at this point in the history
  • Loading branch information
djc authored Jul 15, 2024
1 parent cdf5f03 commit 5922205
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions opentelemetry-sdk/src/trace/tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
trace::{
provider::TracerProvider,
span::{Span, SpanData},
SpanLimits, SpanLinks,
IdGenerator, SpanEvents, SpanLimits, SpanLinks,
},
InstrumentationLibrary,
};
Expand All @@ -22,8 +22,6 @@ use opentelemetry::{
use std::fmt;
use std::sync::Arc;

use super::SpanEvents;

/// `Tracer` implementation to create and manage spans
#[derive(Clone)]
pub struct Tracer {
Expand Down Expand Up @@ -160,6 +158,14 @@ impl Tracer {
span_limits,
)
}

/// The [`IdGenerator`] associated with this tracer.
///
// Note: this is necessary for tracing-opentelemetry's `PreSampledTracer`.
#[doc(hidden)]
pub fn id_generator(&self) -> &dyn IdGenerator {
&*self.provider.config().id_generator
}
}

impl opentelemetry::trace::Tracer for Tracer {
Expand Down

0 comments on commit 5922205

Please sign in to comment.