Skip to main content

ObservabilityPlugin

Trait ObservabilityPlugin 

Source
pub trait ObservabilityPlugin: Send + Sync {
Show 13 methods // Required methods fn start_span(&self, name: &str, attributes: &[(&str, &str)]) -> SpanGuard; fn end_span(&self, span_id: &str); fn add_span_attribute(&self, span_id: &str, key: &str, value: &str); fn set_span_status(&self, span_id: &str, status: SpanStatus); fn record_metric(&self, name: &str, value: f64, labels: &[(&str, &str)]); fn log_structured(&self, level: LogLevel, message: &str, fields: &JsonValue); fn write_log(&self, message: &str); fn flush(&self) -> ObservabilityResult<()>; // Provided methods fn increment_counter(&self, name: &str, labels: &[(&str, &str)]) { ... } fn record_histogram(&self, name: &str, value: f64, labels: &[(&str, &str)]) { ... } fn log(&self, level: LogLevel, message: &str) { ... } fn is_enabled(&self) -> bool { ... } fn plugin_type(&self) -> &'static str { ... }
}
Expand description

Core observability plugin trait

Required Methods§

Source

fn start_span(&self, name: &str, attributes: &[(&str, &str)]) -> SpanGuard

Start a new span and return a guard

Source

fn end_span(&self, span_id: &str)

End a span by ID

Source

fn add_span_attribute(&self, span_id: &str, key: &str, value: &str)

Add an attribute to an existing span

Source

fn set_span_status(&self, span_id: &str, status: SpanStatus)

Set the status of a span

Source

fn record_metric(&self, name: &str, value: f64, labels: &[(&str, &str)])

Record a metric with labels

Source

fn log_structured(&self, level: LogLevel, message: &str, fields: &JsonValue)

Log a structured message with fields

Source

fn write_log(&self, message: &str)

Write log output (implementation-specific)

Source

fn flush(&self) -> ObservabilityResult<()>

Flush any pending telemetry data

Provided Methods§

Source

fn increment_counter(&self, name: &str, labels: &[(&str, &str)])

Increment a counter metric

Source

fn record_histogram(&self, name: &str, value: f64, labels: &[(&str, &str)])

Record a histogram value

Source

fn log(&self, level: LogLevel, message: &str)

Log a simple message

Source

fn is_enabled(&self) -> bool

Check if the plugin is enabled

Source

fn plugin_type(&self) -> &'static str

Get the plugin name/type

Implementors§