Function set_global_guard

Source
pub fn set_global_guard(guard: OtelGuard) -> Result<(), GlobalError>
Expand description

Set the global guard for OpenTelemetry

§Arguments

  • guard - The OtelGuard instance to set globally

§Returns

  • Ok(()) if successful
  • Err(GuardError) if setting fails

§Example

use rustfs_obs::{ init_obs, set_global_guard};

async fn init() -> Result<(), Box<dyn std::error::Error>> {
    let (_, guard) = init_obs(None).await;
    set_global_guard(guard)?;
    Ok(())
}