mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add additional message type metrics to EthRequestHandlerMetrics (#8319)
Co-authored-by: Victor Shih <victor@Basement-PC>
This commit is contained in:
@ -144,7 +144,7 @@ where
|
||||
request: GetBlockHeaders,
|
||||
response: oneshot::Sender<RequestResult<BlockHeaders>>,
|
||||
) {
|
||||
self.metrics.received_headers_requests.increment(1);
|
||||
self.metrics.eth_headers_requests_received_total.increment(1);
|
||||
let headers = self.get_headers_response(request);
|
||||
let _ = response.send(Ok(BlockHeaders(headers)));
|
||||
}
|
||||
@ -155,7 +155,7 @@ where
|
||||
request: GetBlockBodies,
|
||||
response: oneshot::Sender<RequestResult<BlockBodies>>,
|
||||
) {
|
||||
self.metrics.received_bodies_requests.increment(1);
|
||||
self.metrics.eth_bodies_requests_received_total.increment(1);
|
||||
let mut bodies = Vec::new();
|
||||
|
||||
let mut total_bytes = 0;
|
||||
@ -192,6 +192,8 @@ where
|
||||
request: GetReceipts,
|
||||
response: oneshot::Sender<RequestResult<Receipts>>,
|
||||
) {
|
||||
self.metrics.eth_receipts_requests_received_total.increment(1);
|
||||
|
||||
let mut receipts = Vec::new();
|
||||
|
||||
let mut total_bytes = 0;
|
||||
@ -249,7 +251,9 @@ where
|
||||
IncomingEthRequest::GetBlockBodies { peer_id, request, response } => {
|
||||
this.on_bodies_request(peer_id, request, response)
|
||||
}
|
||||
IncomingEthRequest::GetNodeData { .. } => {}
|
||||
IncomingEthRequest::GetNodeData { .. } => {
|
||||
this.metrics.eth_node_data_requests_received_total.increment(1);
|
||||
}
|
||||
IncomingEthRequest::GetReceipts { peer_id, request, response } => {
|
||||
this.on_receipts_request(peer_id, request, response)
|
||||
}
|
||||
|
||||
@ -310,11 +310,17 @@ impl DisconnectMetrics {
|
||||
#[derive(Metrics)]
|
||||
#[metrics(scope = "network")]
|
||||
pub struct EthRequestHandlerMetrics {
|
||||
/// Number of received headers requests
|
||||
pub(crate) received_headers_requests: Counter,
|
||||
/// Number of GetBlockHeaders requests received
|
||||
pub(crate) eth_headers_requests_received_total: Counter,
|
||||
|
||||
/// Number of received bodies requests
|
||||
pub(crate) received_bodies_requests: Counter,
|
||||
/// Number of GetReceipts requests received
|
||||
pub(crate) eth_receipts_requests_received_total: Counter,
|
||||
|
||||
/// Number of GetBlockBodies requests received
|
||||
pub(crate) eth_bodies_requests_received_total: Counter,
|
||||
|
||||
/// Number of GetNodeData requests received
|
||||
pub(crate) eth_node_data_requests_received_total: Counter,
|
||||
}
|
||||
|
||||
/// Eth67 announcement metrics, track entries by TxType
|
||||
|
||||
Reference in New Issue
Block a user