Function get_global_guard

Source
pub fn get_global_guard() -> Result<Arc<Mutex<OtelGuard>>, GlobalError>
Expand description

Get the global guard for OpenTelemetry

§Returns

  • Ok(Arc<Mutex<OtelGuard>>) if guard exists
  • Err(GuardError) if guard not initialized

§Example

use rustfs_obs::get_global_guard;

async fn trace_operation() -> Result<(), Box<dyn std::error::Error>> {
    let guard = get_global_guard()?;
    let _lock = guard.lock().unwrap();
    // Perform traced operation
    Ok(())
}