Skip to main content

ObservabilityExtension

Trait ObservabilityExtension 

Source
pub trait ObservabilityExtension: Extension {
    // Required methods
    fn counter_inc(&self, name: &str, value: u64, labels: &[(&str, &str)]);
    fn gauge_set(&self, name: &str, value: f64, labels: &[(&str, &str)]);
    fn histogram_observe(&self, name: &str, value: f64, labels: &[(&str, &str)]);
    fn span_start(&self, name: &str, parent: Option<u64>) -> u64;
    fn span_end(&self, span_id: u64);
    fn span_event(&self, span_id: u64, name: &str, attributes: &[(&str, &str)]);

    // Provided methods
    fn log_debug(&self, message: &str, fields: &[(&str, &str)]) { ... }
    fn log_info(&self, message: &str, fields: &[(&str, &str)]) { ... }
    fn log_warn(&self, message: &str, fields: &[(&str, &str)]) { ... }
    fn log_error(&self, message: &str, fields: &[(&str, &str)]) { ... }
    fn report_health(&self, health: &HealthInfo) { ... }
}
Expand description

Observability extension

Implement this for metrics, tracing, and logging backends.

§Why Plugin Architecture?

  1. No Dependency Bloat: Core doesn’t pull in Prometheus, DataDog, etc.
  2. Vendor Neutral: Users choose their observability stack
  3. Flexible: Can run without any observability in embedded scenarios

§Available Plugins (separate crates):

  • sochdb-prometheus: Prometheus metrics
  • sochdb-datadog: DataDog integration
  • sochdb-opentelemetry: OpenTelemetry support
  • sochdb-logging-json: JSON structured logging
  • sochdb-logging-logfmt: logfmt style logging

Required Methods§

Source

fn counter_inc(&self, name: &str, value: u64, labels: &[(&str, &str)])

Record a counter increment

Source

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

Record a gauge value

Source

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

Record a histogram observation

Source

fn span_start(&self, name: &str, parent: Option<u64>) -> u64

Start a new span

Source

fn span_end(&self, span_id: u64)

End a span

Source

fn span_event(&self, span_id: u64, name: &str, attributes: &[(&str, &str)])

Add an event to a span

Provided Methods§

Source

fn log_debug(&self, message: &str, fields: &[(&str, &str)])

Log at debug level

Source

fn log_info(&self, message: &str, fields: &[(&str, &str)])

Log at info level

Source

fn log_warn(&self, message: &str, fields: &[(&str, &str)])

Log at warn level

Source

fn log_error(&self, message: &str, fields: &[(&str, &str)])

Log at error level

Source

fn report_health(&self, health: &HealthInfo)

Report health status (called periodically by kernel)

Implementors§