pub trait TelemetryInit {
// Required method
fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait to initialize telemetry based on the provided configuration.
Required Methods§
Sourcefn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initializes telemetry based on the configuration.
This method sets up the global tracer provider, OTLP exporter (if specified), and logger based on the environment.
Implementors§
impl TelemetryInit for TelemetryConfig
Initializes telemetry based on the provided configuration.
This method will:
- Set the global text map propagator to
TraceContextPropagator. - Check for an OTLP endpoint and set up the OTLP exporter if present.
- Configure a logger based on the environment (
developmentor other). - Optionally, set a global tracer if
tracer_idis provided.