pub struct HttpRequestMetrics { /* private fields */ }Implementations§
Source§impl HttpRequestMetrics
impl HttpRequestMetrics
pub fn new() -> HttpRequestMetrics
Sourcepub fn record(&self, method: &'static str, route: &'static str, status: u16)
pub fn record(&self, method: &'static str, route: &'static str, status: u16)
Record one handled HTTP request. method and route must already
be normalized to bounded static labels by the caller (the verb set
and the route catalog are the authorities); status is the raw
response code, folded to its class here.
Sourcepub fn count(&self, labels: HttpRequestLabels) -> u64
pub fn count(&self, labels: HttpRequestLabels) -> u64
Current value of one series, or 0 if never incremented. Visible for tests and the read model.
Sourcepub fn snapshot(&self) -> Vec<(HttpRequestLabels, u64)>
pub fn snapshot(&self) -> Vec<(HttpRequestLabels, u64)>
Deterministically-ordered snapshot of every recorded series. This is
the substrate read surface: /metrics renders it and the
operational read model (red-ui / /cluster/status summaries) derives
request throughput from the same measured facts.
Sourcepub fn render(&self, body: &mut String)
pub fn render(&self, body: &mut String)
Render reddb_http_requests_total{method,route,status} in Prometheus
text exposition format, appending to body. Per ADR 0017 this is a
boundary adapter: it reads the substrate snapshot and shapes it, it
owns no storage. An empty substrate emits only HELP/TYPE (Prometheus
has no envelope concept; absent series read as “nothing happened”).
Trait Implementations§
Source§impl Clone for HttpRequestMetrics
impl Clone for HttpRequestMetrics
Source§fn clone(&self) -> HttpRequestMetrics
fn clone(&self) -> HttpRequestMetrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HttpRequestMetrics
impl Debug for HttpRequestMetrics
Source§impl Default for HttpRequestMetrics
impl Default for HttpRequestMetrics
Source§fn default() -> HttpRequestMetrics
fn default() -> HttpRequestMetrics
Auto Trait Implementations§
impl Forget for HttpRequestMetrics
impl Freeze for HttpRequestMetricswhere
*const ArcInner<Mutex<HashMap<HttpRequestLabels, u64>>> is !null: Freeze,
PhantomData<ArcInner<Mutex<HashMap<HttpRequestLabels, u64>>>>: Freeze,
impl Move for HttpRequestMetrics
impl RefUnwindSafe for HttpRequestMetrics
impl Send for HttpRequestMetrics
impl Sync for HttpRequestMetrics
impl Unpin for HttpRequestMetrics
impl UnsafeUnpin for HttpRequestMetricswhere
*const ArcInner<Mutex<HashMap<HttpRequestLabels, u64>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<HashMap<HttpRequestLabels, u64>>>>: UnsafeUnpin,
impl UnwindSafe for HttpRequestMetrics
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request