Skip to main content

MetricsCollector

Trait MetricsCollector 

Source
pub trait MetricsCollector: Send + Sync {
Show 18 methods // Required methods fn record_exchange_duration(&self, route_id: &str, duration: Duration); fn increment_errors(&self, route_id: &str, error_type: &str); fn increment_exchanges(&self, route_id: &str); fn set_queue_depth(&self, queue: &str, depth: usize); fn record_circuit_breaker_change( &self, route_id: &str, from: &str, to: &str, ); // Provided methods fn record_histogram( &self, _name: &str, _value: f64, _labels: &[(&str, &str)], ) { ... } fn record_counter(&self, _name: &str, _value: f64, _labels: &[(&str, &str)]) { ... } fn increment_retry_attempt(&self, _scheme: &str, _operation: &str) { ... } fn increment_circuit_breaker_rejection(&self, _route: &str) { ... } fn set_route_state(&self, _route: &str, _state: &str) { ... } fn clear_route_state(&self, _route: &str) { ... } fn record_build_info(&self, _version: &str, _git_sha: &str) { ... } fn record_uptime(&self, _seconds: f64) { ... } fn record_component_operation( &self, _component: &str, _operation: &str, _outcome: &str, ) { ... } fn set_pinned_client_cache_size(&self, _component: &str, _entries: u64) { ... } fn increment_pinned_client_cache_hit(&self, _component: &str) { ... } fn increment_pinned_client_cache_miss(&self, _component: &str) { ... } fn set_allocator_memory(&self, _stat: AllocatorStat, _bytes: u64) { ... }
}
Expand description

Trait for collecting metrics from the Camel runtime. Implementations can integrate with Prometheus, OpenTelemetry, etc.

Required Methods§

Source

fn record_exchange_duration(&self, route_id: &str, duration: Duration)

Record exchange processing time

Source

fn increment_errors(&self, route_id: &str, error_type: &str)

Increment error counter

Source

fn increment_exchanges(&self, route_id: &str)

Increment exchange counter

Source

fn set_queue_depth(&self, queue: &str, depth: usize)

Update the depth of a buffered stage’s queue (camel_queue_depth{queue}). The queue label is a closed set of component-declared identifiers (seda:<endpoint-name>, aggregator:<route>, resequencer:<route>).

Source

fn record_circuit_breaker_change(&self, route_id: &str, from: &str, to: &str)

Record circuit breaker state change

Provided Methods§

Source

fn record_histogram(&self, _name: &str, _value: f64, _labels: &[(&str, &str)])

Record a histogram observation (e.g., cost, latency distribution). Default: no-op (backward-compatible).

Source

fn record_counter(&self, _name: &str, _value: f64, _labels: &[(&str, &str)])

Record a monotonically-increasing counter (e.g. foo_total). Default: no-op (backward-compatible).

Source

fn increment_retry_attempt(&self, _scheme: &str, _operation: &str)

Increment the per-attempt retry counter (camel_retry_attempts_total, labels scheme+operation). Called once per retry attempt, including the first. Default: no-op (backward-compatible).

Source

fn increment_circuit_breaker_rejection(&self, _route: &str)

Increment the circuit-breaker rejection counter (camel_circuit_breaker_rejections_total, label route). Open-breaker fast-fails count here, not as errors. Default: no-op (backward-compatible).

Source

fn set_route_state(&self, _route: &str, _state: &str)

Publish a route lifecycle-state transition (camel_route_state, labels route+state). state is the projection’s state label — a closed set by construction (Registered, Starting, Started, Suspended, Stopping, Stopped, Failed). Implementations keep the route’s last-published state so a transition sets the new series to 1 and zeroes the previous one. Default: no-op (backward-compatible).

Source

fn clear_route_state(&self, _route: &str)

Drop a route’s state series (route removed/undeployed) so a scrape reflects only routes that exist.

Source

fn record_build_info(&self, _version: &str, _git_sha: &str)

Publish build identification (camel_build_info{git_sha,version}, value 1). Called once when the context is built. Default: no-op (backward-compatible).

Source

fn record_uptime(&self, _seconds: f64)

Publish process uptime in seconds (camel_uptime_seconds), refreshed periodically by the runtime. Default: no-op (backward-compatible).

Source

fn record_component_operation( &self, _component: &str, _operation: &str, _outcome: &str, )

Increment the uniform component-operations counter (camel_component_operations_total, labels component+operation+ outcome). outcome is a closed set — “success” or “failure” only; callers derive it from a bool (see ComponentMetrics), never pass free text. Default: no-op (backward-compatible).

Source

fn set_pinned_client_cache_size(&self, _component: &str, _entries: u64)

Publish the pinned client cache size for a component (camel_pinned_client_cache_size{component}, gauge, unit: entries). Emitted by the owning component after each lookup, reflecting the current (approximate) entry count. Default: no-op (backward-compatible).

Source

fn increment_pinned_client_cache_hit(&self, _component: &str)

Increment the pinned client cache hit counter for a component (camel_pinned_client_cache_hits_total{component}) — a pinned lookup served by the cache without a rebuild. Default: no-op (backward-compatible).

Source

fn increment_pinned_client_cache_miss(&self, _component: &str)

Increment the pinned client cache miss counter for a component (camel_pinned_client_cache_misses_total{component}) — a pinned lookup that required a client rebuild. Default: no-op (backward-compatible).

Source

fn set_allocator_memory(&self, _stat: AllocatorStat, _bytes: u64)

Publish an allocator memory statistic (camel_allocator_memory_bytes{stat}, gauge, unit: bytes). stat is a closed AllocatorStat variant; the sampler refreshes the current value periodically. Default: no-op (backward-compatible).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§