Struct opentelemetry::sdk::trace::Config
source · pub struct Config {
pub sampler: Box<dyn ShouldSample>,
pub id_generator: Box<dyn IdGenerator>,
pub span_limits: SpanLimits,
pub resource: Option<Arc<Resource>>,
}
Expand description
Tracer configuration
Fields§
§sampler: Box<dyn ShouldSample>
The sampler that the sdk should use
id_generator: Box<dyn IdGenerator>
The id generator that the sdk should use
span_limits: SpanLimits
span limits
resource: Option<Arc<Resource>>
Contains attributes representing an entity that produces telemetry.
Implementations§
source§impl Config
impl Config
sourcepub fn with_sampler<T: ShouldSample + 'static>(self, sampler: T) -> Self
pub fn with_sampler<T: ShouldSample + 'static>(self, sampler: T) -> Self
Specify the sampler to be used.
sourcepub fn with_id_generator<T: IdGenerator + 'static>(
self,
id_generator: T
) -> Self
pub fn with_id_generator<T: IdGenerator + 'static>( self, id_generator: T ) -> Self
Specify the id generator to be used.
sourcepub fn with_max_events_per_span(self, max_events: u32) -> Self
pub fn with_max_events_per_span(self, max_events: u32) -> Self
Specify the number of events to be recorded per span.
sourcepub fn with_max_attributes_per_span(self, max_attributes: u32) -> Self
pub fn with_max_attributes_per_span(self, max_attributes: u32) -> Self
Specify the number of attributes to be recorded per span.
sourcepub fn with_max_links_per_span(self, max_links: u32) -> Self
pub fn with_max_links_per_span(self, max_links: u32) -> Self
Specify the number of events to be recorded per span.
sourcepub fn with_max_attributes_per_event(self, max_attributes: u32) -> Self
pub fn with_max_attributes_per_event(self, max_attributes: u32) -> Self
Specify the number of attributes one event can have.
sourcepub fn with_max_attributes_per_link(self, max_attributes: u32) -> Self
pub fn with_max_attributes_per_link(self, max_attributes: u32) -> Self
Specify the number of attributes one link can have.
sourcepub fn with_span_limits(self, span_limits: SpanLimits) -> Self
pub fn with_span_limits(self, span_limits: SpanLimits) -> Self
Specify all limit via the span_limits
sourcepub fn with_resource(self, resource: Resource) -> Self
pub fn with_resource(self, resource: Resource) -> Self
Specify the attributes representing the entity that produces telemetry
sourcepub fn with_no_resource(self) -> Self
pub fn with_no_resource(self) -> Self
Use empty resource instead of default resource in this config.
Usually if no resource is provided, SDK will assign a default resource
to the TracerProvider
, which could impact the performance. Performance
sensitive application can use function to disable such behavior and assign
no resource to TracerProvider
.