mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
feat(engine): add metric for forkchoiceUpdated response -> newPayload (#21380)
This commit is contained in:
@@ -254,6 +254,8 @@ pub(crate) struct NewPayloadStatusMetrics {
|
||||
pub(crate) time_between_new_payloads: Histogram,
|
||||
/// Time from previous payload start to current payload start (total interval).
|
||||
pub(crate) new_payload_interval: Histogram,
|
||||
/// Time diff between forkchoice updated call response and the next new payload call request.
|
||||
pub(crate) forkchoice_updated_new_payload_time_diff: Histogram,
|
||||
}
|
||||
|
||||
impl NewPayloadStatusMetrics {
|
||||
@@ -261,6 +263,7 @@ impl NewPayloadStatusMetrics {
|
||||
pub(crate) fn update_response_metrics(
|
||||
&mut self,
|
||||
start: Instant,
|
||||
latest_forkchoice_updated_at: &mut Option<Instant>,
|
||||
result: &Result<TreeOutcome<PayloadStatus>, InsertBlockFatalError>,
|
||||
gas_used: u64,
|
||||
) {
|
||||
@@ -293,6 +296,10 @@ impl NewPayloadStatusMetrics {
|
||||
self.new_payload_messages.increment(1);
|
||||
self.new_payload_latency.record(elapsed);
|
||||
self.new_payload_last.set(elapsed);
|
||||
if let Some(latest_forkchoice_updated_at) = latest_forkchoice_updated_at.take() {
|
||||
self.forkchoice_updated_new_payload_time_diff
|
||||
.record(start - latest_forkchoice_updated_at);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1514,10 +1514,12 @@ where
|
||||
let gas_used = payload.gas_used();
|
||||
let num_hash = payload.num_hash();
|
||||
let mut output = self.on_new_payload(payload);
|
||||
self.metrics
|
||||
.engine
|
||||
.new_payload
|
||||
.update_response_metrics(start, &output, gas_used);
|
||||
self.metrics.engine.new_payload.update_response_metrics(
|
||||
start,
|
||||
&mut self.metrics.engine.forkchoice_updated.latest_finish_at,
|
||||
&output,
|
||||
gas_used,
|
||||
);
|
||||
|
||||
let maybe_event =
|
||||
output.as_mut().ok().and_then(|out| out.event.take());
|
||||
|
||||
Reference in New Issue
Block a user