Skip to main content

JanusMetrics

Struct JanusMetrics 

Source
pub struct JanusMetrics {
Show 22 fields pub signals_generated_total: CounterVec, pub signal_generation_duration: HistogramVec, pub signal_confidence: GaugeVec, pub module_health: GaugeVec, pub module_uptime_seconds: GaugeVec, pub http_requests_total: CounterVec, pub http_request_duration: HistogramVec, pub http_requests_in_flight: Gauge, pub db_queries_total: CounterVec, pub db_query_duration: HistogramVec, pub db_pool_size: Gauge, pub redis_operations_total: CounterVec, pub redis_operation_duration: HistogramVec, pub redis_connected: Gauge, pub websocket_connections: Gauge, pub websocket_messages_sent: CounterVec, pub supervisor_restarts_total: Counter, pub supervisor_active_services: Gauge, pub supervisor_spawned_total: Counter, pub supervisor_terminated_total: Counter, pub supervisor_circuit_breaker_trips: Counter, pub supervisor_uptime_seconds: HistogramVec,
}
Expand description

Unified metrics for all JANUS modules

Fields§

§signals_generated_total: CounterVec

Total signals generated

§signal_generation_duration: HistogramVec

Signal generation latency

§signal_confidence: GaugeVec

Current signal confidence

§module_health: GaugeVec

Module health (1 = healthy, 0 = unhealthy)

§module_uptime_seconds: GaugeVec

Module uptime in seconds

§http_requests_total: CounterVec

HTTP requests total

§http_request_duration: HistogramVec

HTTP request duration

§http_requests_in_flight: Gauge

HTTP requests in flight

§db_queries_total: CounterVec

Database query count

§db_query_duration: HistogramVec

Database query duration

§db_pool_size: Gauge

Database connection pool size

§redis_operations_total: CounterVec

Redis operations total

§redis_operation_duration: HistogramVec

Redis operation duration

§redis_connected: Gauge

Redis connection status

§websocket_connections: Gauge

Active WebSocket connections

§websocket_messages_sent: CounterVec

WebSocket messages sent

§supervisor_restarts_total: Counter

Total number of service restarts across all supervised services. Maps to: janus_supervisor_restarts_total

§supervisor_active_services: Gauge

Number of services currently in a non-terminal phase. Maps to: janus_supervisor_active_services

§supervisor_spawned_total: Counter

Total number of services ever spawned (including initial + restarts). Maps to: janus_supervisor_spawned_total

§supervisor_terminated_total: Counter

Total number of services that have terminated. Maps to: janus_supervisor_terminated_total

§supervisor_circuit_breaker_trips: Counter

Total number of circuit breaker trips. Maps to: janus_supervisor_circuit_breaker_trips_total

§supervisor_uptime_seconds: HistogramVec

Per-service uptime histogram (seconds). Maps to: janus_supervisor_uptime_seconds

Implementations§

Source§

impl JanusMetrics

Source

pub fn new() -> Self

Create new metrics instance

Source

pub fn record_signal( &self, module: &str, signal_type: &str, symbol: &str, confidence: f64, )

Record a signal generation

Source

pub fn record_module_health( &self, module: &str, healthy: bool, uptime_seconds: f64, )

Record module health

Source

pub fn record_http_request( &self, method: &str, path: &str, status: u16, duration_secs: f64, )

Record HTTP request

Source

pub fn record_supervisor_spawn(&self)

Record a service spawn event (counter only — the active_services gauge is managed by SupervisorMetrics).

Source

pub fn record_supervisor_restart(&self)

Record a service restart event.

Source

pub fn record_supervisor_termination(&self)

Record a service termination event (counter only — the active_services gauge is managed by SupervisorMetrics).

Source

pub fn record_supervisor_circuit_breaker_trip(&self)

Record a circuit breaker trip event.

Source

pub fn record_supervisor_service_uptime(&self, service: &str, uptime_secs: f64)

Record a service’s cumulative uptime when it terminates.

Source

pub fn encode(&self) -> String

Get all metrics as text (for /metrics endpoint)

Trait Implementations§

Source§

impl Default for JanusMetrics

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more