Skip to main content

RuntimeObservability

Trait RuntimeObservability 

Source
pub trait RuntimeObservability: Send + Sync {
    // Required methods
    fn metrics(&self) -> Arc<dyn MetricsCollector> ⓘ;
    fn health(&self) -> Arc<dyn HealthCheckRegistry> ⓘ;

    // Provided methods
    fn component_metrics(&self, component: &str) -> ComponentMetrics { ... }
    fn in_flight_counter(&self) -> Option<Arc<InFlightGauge>> { ... }
}
Expand description

Narrow observability surface available to Endpoint consumers and producers.

Implemented blanket for every T: ComponentContext, so CamelContext (the spec’s “DefaultRuntime”) and any test ctx automatically satisfy this trait. Endpoints receive Arc<dyn RuntimeObservability> at create_consumer / create_producer time (per Phase A closure spec).

Send + Sync is mandatory — Endpoints spawn across tokio tasks.

Required Methods§

Source

fn metrics(&self) -> Arc<dyn MetricsCollector> ⓘ

Active metrics collector. Used for increment_errors(route_id, label) per ADR-0012 categories (b′) and (e).

Source

fn health(&self) -> Arc<dyn HealthCheckRegistry> ⓘ

Active health-check registry. Used for force_unhealthy_for_route(route_id, name, reason) per ADR-0012 category (g).

Provided Methods§

Source

fn component_metrics(&self, component: &str) -> ComponentMetrics

Facade for the uniform component-operations family (camel_component_operations_total{component,operation,outcome}, dashboard-observability Task 4.1), scoped to component so the handle carries both the identity and the resolved switch.

The per-component lever snapshot is baked in at facade construction: the component series flow only when component_metric_levers().enabled_for(component) is true, while failures always reach the non-disableable error family — error emission is never lever-gated.

Default: lever off — impls that do not override component_metric_levers() (manual test runtimes AND any context wired without a levers snapshot) keep the component series suppressed and only forward errors. In production the blanket impl resolves the context’s MetricsLeversConfig snapshot per component.

Source

fn in_flight_counter(&self) -> Option<Arc<InFlightGauge>>

Context-global gauge of accepted-not-completed exchanges (drainclaim), forwarded from ComponentContext::in_flight_counter. Default None keeps runtimes that install no gauge uncounted.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§