Struct sc_rpc_server::middleware::RpcMetrics
source · pub struct RpcMetrics { /* private fields */ }
Expand description
Metrics for RPC middleware storing information about the number of requests started/completed, calls started/completed and their timings.
Implementations§
source§impl RpcMetrics
impl RpcMetrics
Trait Implementations§
source§impl Clone for RpcMetrics
impl Clone for RpcMetrics
source§fn clone(&self) -> RpcMetrics
fn clone(&self) -> RpcMetrics
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RpcMetrics
impl Debug for RpcMetrics
source§impl Logger for RpcMetrics
impl Logger for RpcMetrics
§type Instant = Instant
type Instant = Instant
Intended to carry timestamp of a request, for example
std::time::Instant
. How the trait
measures time, if at all, is entirely up to the implementation.source§fn on_connect(
&self,
_remote_addr: SocketAddr,
_request: &HttpRequest,
transport: TransportProtocol,
)
fn on_connect( &self, _remote_addr: SocketAddr, _request: &HttpRequest, transport: TransportProtocol, )
Called when a new client connects
source§fn on_request(&self, transport: TransportProtocol) -> Self::Instant
fn on_request(&self, transport: TransportProtocol) -> Self::Instant
Called when a new JSON-RPC request comes to the server.
source§fn on_call(
&self,
name: &str,
params: Params<'_>,
kind: MethodKind,
transport: TransportProtocol,
)
fn on_call( &self, name: &str, params: Params<'_>, kind: MethodKind, transport: TransportProtocol, )
Called on each JSON-RPC method call, batch requests will trigger
on_call
multiple times.source§fn on_result(
&self,
name: &str,
success: bool,
started_at: Self::Instant,
transport: TransportProtocol,
)
fn on_result( &self, name: &str, success: bool, started_at: Self::Instant, transport: TransportProtocol, )
Called on each JSON-RPC method completion, batch requests will trigger
on_result
multiple times.source§fn on_response(
&self,
result: &str,
started_at: Self::Instant,
transport: TransportProtocol,
)
fn on_response( &self, result: &str, started_at: Self::Instant, transport: TransportProtocol, )
Called once the JSON-RPC request is finished and response is sent to the output buffer.
source§fn on_disconnect(&self, _remote_addr: SocketAddr, transport: TransportProtocol)
fn on_disconnect(&self, _remote_addr: SocketAddr, transport: TransportProtocol)
Called when a client disconnects
Auto Trait Implementations§
impl Freeze for RpcMetrics
impl !RefUnwindSafe for RpcMetrics
impl Send for RpcMetrics
impl Sync for RpcMetrics
impl Unpin for RpcMetrics
impl !UnwindSafe for RpcMetrics
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)