pub struct GatewayMetrics {
pub registry: Registry,
pub request_count: IntCounterVec,
pub request_duration: HistogramVec,
pub request_errors: IntCounterVec,
pub node_execution_count: IntCounterVec,
pub node_execution_duration: HistogramVec,
pub node_errors: IntCounterVec,
pub consumer_requests: IntCounterVec,
pub counter_store_errors: IntCounterVec,
pub cache_events: IntCounterVec,
pub session_store_errors: IntCounterVec,
}Expand description
Global metrics registry for the gateway.
Owns a dedicated Prometheus [Registry] with all collectors
pre-registered. All collectors are internally thread-safe, so a single
instance is shared (behind an Arc) between the data-plane and the
Admin API.
Fields§
§registry: RegistryRegistry holding every collector below; gathered by Self::render.
request_count: IntCounterVecgateway_requests_total — requests by route, method, status.
request_duration: HistogramVecgateway_request_duration_seconds — end-to-end request latency
histogram per route (buckets 1ms to 5s).
request_errors: IntCounterVecgateway_request_errors_total — one increment per error record in
Context.errors at the end of the request, by route and error_code.
This counts genuine node failures only. Deliberate outcome exits
(denied, limited, broken, abort, redirect, preflight,
routed, hit) append no error record and therefore never increment
it — track those through gateway_requests_total’s status label.
node_execution_count: IntCounterVecgateway_node_executions_total — graph node executions by policy,
node_id, node_type.
node_execution_duration: HistogramVecgateway_node_duration_seconds — per-node execution latency
histogram by policy and node_id (buckets 0.1ms to 500ms).
node_errors: IntCounterVecgateway_node_errors_total — node failures by policy, node_id,
error_code.
consumer_requests: IntCounterVecgateway_consumer_requests_total — requests attributed to an
authenticated consumer, by route (parity with APISIX’s prometheus
per-consumer counter). Recorded by the prometheus node, which must be
placed after the auth node that attaches the consumer.
counter_store_errors: IntCounterVecCounter-store (stores:) backend errors, per named store.
cache_events: IntCounterVecResponse-cache outcomes, per backend, store, and event.
store is the named stores: entry for policy: redis, and the
empty string for policy: local (which has no store to name) — the
same convention counter_store_errors/session_store_errors would
use if they had a backend without one.
error is the one that matters: a cache degraded to always-miss keeps
serving correct responses, just slower and with more upstream load, so
it is invisible in every other signal.
session_store_errors: IntCounterVecSession-store (stores:) backend errors, per named store.
Implementations§
Source§impl GatewayMetrics
impl GatewayMetrics
Auto Trait Implementations§
impl !RefUnwindSafe for GatewayMetrics
impl !UnwindSafe for GatewayMetrics
impl Freeze for GatewayMetrics
impl Send for GatewayMetrics
impl Sync for GatewayMetrics
impl Unpin for GatewayMetrics
impl UnsafeUnpin for GatewayMetrics
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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