MetricsRegistry

Struct MetricsRegistry 

Source
pub struct MetricsRegistry {
Show 40 fields pub requests_total: IntCounterVec, pub requests_duration_seconds: HistogramVec, pub requests_in_flight: IntGaugeVec, pub requests_by_path_total: IntCounterVec, pub request_duration_by_path_seconds: HistogramVec, pub average_latency_by_path_seconds: GaugeVec, pub workspace_requests_total: IntCounterVec, pub workspace_requests_duration_seconds: HistogramVec, pub workspace_active_routes: IntGaugeVec, pub workspace_errors_total: IntCounterVec, pub errors_total: IntCounterVec, pub error_rate: GaugeVec, pub plugin_executions_total: IntCounterVec, pub plugin_execution_duration_seconds: HistogramVec, pub plugin_errors_total: IntCounterVec, pub ws_connections_active: IntGauge, pub ws_connections_total: IntCounter, pub ws_connection_duration_seconds: HistogramVec, pub ws_messages_sent: IntCounter, pub ws_messages_received: IntCounter, pub ws_errors_total: IntCounter, pub smtp_connections_active: IntGauge, pub smtp_connections_total: IntCounter, pub smtp_messages_received_total: IntCounter, pub smtp_messages_stored_total: IntCounter, pub smtp_errors_total: IntCounterVec, pub mqtt_connections_active: IntGauge, pub mqtt_connections_total: IntCounter, pub mqtt_messages_published_total: IntCounter, pub mqtt_messages_received_total: IntCounter, pub mqtt_topics_active: IntGauge, pub mqtt_subscriptions_active: IntGauge, pub mqtt_retained_messages: IntGauge, pub mqtt_errors_total: IntCounterVec, pub memory_usage_bytes: Gauge, pub cpu_usage_percent: Gauge, pub thread_count: Gauge, pub uptime_seconds: Gauge, pub active_scenario_mode: IntGauge, pub chaos_triggers_total: IntCounter, /* private fields */
}
Expand description

Global metrics registry for MockForge

Fields§

§requests_total: IntCounterVec§requests_duration_seconds: HistogramVec§requests_in_flight: IntGaugeVec§requests_by_path_total: IntCounterVec§request_duration_by_path_seconds: HistogramVec§average_latency_by_path_seconds: GaugeVec§workspace_requests_total: IntCounterVec§workspace_requests_duration_seconds: HistogramVec§workspace_active_routes: IntGaugeVec§workspace_errors_total: IntCounterVec§errors_total: IntCounterVec§error_rate: GaugeVec§plugin_executions_total: IntCounterVec§plugin_execution_duration_seconds: HistogramVec§plugin_errors_total: IntCounterVec§ws_connections_active: IntGauge§ws_connections_total: IntCounter§ws_connection_duration_seconds: HistogramVec§ws_messages_sent: IntCounter§ws_messages_received: IntCounter§ws_errors_total: IntCounter§smtp_connections_active: IntGauge§smtp_connections_total: IntCounter§smtp_messages_received_total: IntCounter§smtp_messages_stored_total: IntCounter§smtp_errors_total: IntCounterVec§mqtt_connections_active: IntGauge§mqtt_connections_total: IntCounter§mqtt_messages_published_total: IntCounter§mqtt_messages_received_total: IntCounter§mqtt_topics_active: IntGauge§mqtt_subscriptions_active: IntGauge§mqtt_retained_messages: IntGauge§mqtt_errors_total: IntCounterVec§memory_usage_bytes: Gauge§cpu_usage_percent: Gauge§thread_count: Gauge§uptime_seconds: Gauge§active_scenario_mode: IntGauge§chaos_triggers_total: IntCounter

Implementations§

Source§

impl MetricsRegistry

Source

pub fn new() -> Self

Create a new metrics registry with all metrics initialized

Source

pub fn registry(&self) -> &Registry

Get the underlying Prometheus registry

Source

pub fn is_initialized(&self) -> bool

Check if the registry is initialized

Source

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

Record an HTTP request

Source

pub fn record_grpc_request( &self, method: &str, status: &str, duration_seconds: f64, )

Record a gRPC request

Source

pub fn record_ws_message_sent(&self)

Record a WebSocket message

Source

pub fn record_ws_message_received(&self)

Record a WebSocket message received

Source

pub fn record_graphql_request( &self, operation: &str, status: u16, duration_seconds: f64, )

Record a GraphQL request

Source

pub fn record_plugin_execution( &self, plugin_name: &str, success: bool, duration_seconds: f64, )

Record a plugin execution

Source

pub fn increment_in_flight(&self, protocol: &str)

Increment in-flight requests

Source

pub fn decrement_in_flight(&self, protocol: &str)

Decrement in-flight requests

Source

pub fn record_error(&self, protocol: &str, error_type: &str)

Record an error

Source

pub fn update_memory_usage(&self, bytes: f64)

Update memory usage

Source

pub fn update_cpu_usage(&self, percent: f64)

Update CPU usage

Source

pub fn set_scenario_mode(&self, mode: i64)

Set active scenario mode (0=healthy, 1=degraded, 2=error, 3=chaos)

Source

pub fn record_chaos_trigger(&self)

Record a chaos trigger

Source

pub fn record_http_request_with_path( &self, path: &str, method: &str, status: u16, duration_seconds: f64, )

Record an HTTP request with path information

Source

pub fn record_ws_connection_established(&self)

Record a WebSocket connection established

Source

pub fn record_ws_connection_closed(&self, duration_seconds: f64, status: &str)

Record a WebSocket connection closed

Source

pub fn record_ws_error(&self)

Record a WebSocket error

Source

pub fn record_smtp_connection_established(&self)

Record an SMTP connection established

Source

pub fn record_smtp_connection_closed(&self)

Record an SMTP connection closed

Source

pub fn record_smtp_message_received(&self)

Record an SMTP message received

Source

pub fn record_smtp_message_stored(&self)

Record an SMTP message stored

Source

pub fn record_smtp_error(&self, error_type: &str)

Record an SMTP error

Source

pub fn update_thread_count(&self, count: f64)

Update thread count

Source

pub fn update_uptime(&self, seconds: f64)

Update uptime

Source

pub fn record_workspace_request( &self, workspace_id: &str, method: &str, status: u16, duration_seconds: f64, )

Record a workspace request

Source

pub fn update_workspace_active_routes(&self, workspace_id: &str, count: i64)

Update workspace active routes count

Source

pub fn record_workspace_error(&self, workspace_id: &str, error_type: &str)

Record a workspace error

Source

pub fn increment_workspace_routes(&self, workspace_id: &str)

Increment workspace active routes

Source

pub fn decrement_workspace_routes(&self, workspace_id: &str)

Decrement workspace active routes

Trait Implementations§

Source§

impl Clone for MetricsRegistry

Source§

fn clone(&self) -> MetricsRegistry

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for MetricsRegistry

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,