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§
Sourcefn start_span(&self, name: &str, attributes: &[(&str, &str)]) -> SpanGuard
fn start_span(&self, name: &str, attributes: &[(&str, &str)]) -> SpanGuard
Start a new span and return a guard
Sourcefn add_span_attribute(&self, span_id: &str, key: &str, value: &str)
fn add_span_attribute(&self, span_id: &str, key: &str, value: &str)
Add an attribute to an existing span
Sourcefn set_span_status(&self, span_id: &str, status: SpanStatus)
fn set_span_status(&self, span_id: &str, status: SpanStatus)
Set the status of a span
Sourcefn record_metric(&self, name: &str, value: f64, labels: &[(&str, &str)])
fn record_metric(&self, name: &str, value: f64, labels: &[(&str, &str)])
Record a metric with labels
Sourcefn log_structured(&self, level: LogLevel, message: &str, fields: &JsonValue)
fn log_structured(&self, level: LogLevel, message: &str, fields: &JsonValue)
Log a structured message with fields
Sourcefn flush(&self) -> ObservabilityResult<()>
fn flush(&self) -> ObservabilityResult<()>
Flush any pending telemetry data
Provided Methods§
Sourcefn increment_counter(&self, name: &str, labels: &[(&str, &str)])
fn increment_counter(&self, name: &str, labels: &[(&str, &str)])
Increment a counter metric
Sourcefn record_histogram(&self, name: &str, value: f64, labels: &[(&str, &str)])
fn record_histogram(&self, name: &str, value: f64, labels: &[(&str, &str)])
Record a histogram value
Sourcefn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Check if the plugin is enabled
Sourcefn plugin_type(&self) -> &'static str
fn plugin_type(&self) -> &'static str
Get the plugin name/type