init_otel

Function init_otel 

Source
pub fn init_otel(
    config: &OtelConfig,
    main_crate: &'static str,
    service_name: &'static str,
    pkg_version: &'static str,
) -> Result<ProvidersGuard, OtelInitError>
Expand description

Initializes the OpenTelemetry

example

use rust_telemetry::config;

#[tokio::main]
async fn main() {
	let _guard = rust_telemetry::init_otel(
		&config::OtelConfig::default(),
		env!("CARGO_CRATE_NAME"),
		env!("CARGO_PKG_NAME"),
		env!("CARGO_PKG_VERSION"),
	);

	// ...
}