Skip to main content

ProtocolMetrics

Struct ProtocolMetrics 

Source
pub struct ProtocolMetrics {
Show 14 fields pub requests_total: AtomicU64, pub responses_total: AtomicU64, pub timeouts_total: AtomicU64, pub connection_errors_total: AtomicU64, pub serialization_errors_total: AtomicU64, pub flow_control_pauses_total: AtomicU64, pub flow_control_resumes_total: AtomicU64, pub flow_control_rejections_total: AtomicU64, pub in_flight_requests: AtomicU64, pub buffer_utilization_percent: AtomicU64, pub healthy_connections: AtomicU64, pub paused_connections: AtomicU64, pub serialization_time: HistogramMetric, pub request_duration: HistogramMetric,
}
Expand description

Protocol-level metrics for the agent pool.

Fields§

§requests_total: AtomicU64

Total requests sent

§responses_total: AtomicU64

Total responses received

§timeouts_total: AtomicU64

Requests that timed out

§connection_errors_total: AtomicU64

Connection errors

§serialization_errors_total: AtomicU64

Serialization errors

§flow_control_pauses_total: AtomicU64

Flow control pause events

§flow_control_resumes_total: AtomicU64

Flow control resume events

§flow_control_rejections_total: AtomicU64

Requests rejected due to flow control

§in_flight_requests: AtomicU64

Current in-flight requests

§buffer_utilization_percent: AtomicU64

Current buffer utilization (0-100)

§healthy_connections: AtomicU64

Number of healthy connections

§paused_connections: AtomicU64

Number of paused connections (flow control)

§serialization_time: HistogramMetric

Serialization time histogram

§request_duration: HistogramMetric

Request duration histogram (end-to-end)

Implementations§

Source§

impl ProtocolMetrics

Source

pub fn new() -> Self

Create new protocol metrics.

Source

pub fn inc_requests(&self)

Increment requests total.

Source

pub fn inc_responses(&self)

Increment responses total.

Source

pub fn inc_timeouts(&self)

Increment timeouts.

Source

pub fn inc_connection_errors(&self)

Increment connection errors.

Source

pub fn inc_serialization_errors(&self)

Increment serialization errors.

Source

pub fn record_flow_pause(&self)

Record flow control pause.

Source

pub fn record_flow_resume(&self)

Record flow control resume.

Source

pub fn record_flow_rejection(&self)

Record flow control rejection.

Source

pub fn set_in_flight(&self, count: u64)

Set in-flight requests gauge.

Source

pub fn inc_in_flight(&self)

Increment in-flight requests.

Source

pub fn dec_in_flight(&self)

Decrement in-flight requests.

Source

pub fn set_buffer_utilization(&self, percent: u64)

Set buffer utilization percentage.

Source

pub fn set_healthy_connections(&self, count: u64)

Set healthy connections gauge.

Source

pub fn set_paused_connections(&self, count: u64)

Set paused connections gauge.

Source

pub fn record_serialization_time(&self, duration: Duration)

Record serialization time.

Source

pub fn record_request_duration(&self, duration: Duration)

Record request duration.

Source

pub fn snapshot(&self) -> ProtocolMetricsSnapshot

Get a snapshot of all metrics.

Source

pub fn to_prometheus(&self, prefix: &str) -> String

Export metrics in Prometheus text format.

Trait Implementations§

Source§

impl Debug for ProtocolMetrics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProtocolMetrics

Source§

fn default() -> ProtocolMetrics

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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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