mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 13:01:07 +00:00
add metric for timing recovery and approval (#3228)
This commit is contained in:
committed by
GitHub
parent
5bc2b2779d
commit
428a4178ff
@@ -128,6 +128,7 @@ struct MetricsInner {
|
||||
candidate_approval_time_ticks: prometheus::Histogram,
|
||||
block_approval_time_ticks: prometheus::Histogram,
|
||||
time_db_transaction: prometheus::Histogram,
|
||||
time_recover_and_approve: prometheus::Histogram,
|
||||
}
|
||||
|
||||
/// Aproval Voting metrics.
|
||||
@@ -180,6 +181,10 @@ impl Metrics {
|
||||
fn time_db_transaction(&self) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
|
||||
self.0.as_ref().map(|metrics| metrics.time_db_transaction.start_timer())
|
||||
}
|
||||
|
||||
fn time_recover_and_approve(&self) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
|
||||
self.0.as_ref().map(|metrics| metrics.time_recover_and_approve.start_timer())
|
||||
}
|
||||
}
|
||||
|
||||
impl metrics::Metrics for Metrics {
|
||||
@@ -249,6 +254,15 @@ impl metrics::Metrics for Metrics {
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
time_recover_and_approve: prometheus::register(
|
||||
prometheus::Histogram::with_opts(
|
||||
prometheus::HistogramOpts::new(
|
||||
"parachain_time_recover_and_approve",
|
||||
"Time spent recovering and approving data in approval voting",
|
||||
)
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
};
|
||||
|
||||
Ok(Metrics(Some(metrics)))
|
||||
@@ -729,6 +743,7 @@ async fn handle_actions(
|
||||
|
||||
let handle = launch_approval(
|
||||
ctx,
|
||||
metrics.clone(),
|
||||
background_tx.clone(),
|
||||
session,
|
||||
&candidate,
|
||||
@@ -1857,6 +1872,7 @@ fn process_wakeup(
|
||||
// to cancel the background work and any requests it has spawned.
|
||||
async fn launch_approval(
|
||||
ctx: &mut impl SubsystemContext,
|
||||
metrics: Metrics,
|
||||
mut background_tx: mpsc::Sender<BackgroundRequest>,
|
||||
session_index: SessionIndex,
|
||||
candidate: &CandidateReceipt,
|
||||
@@ -1877,6 +1893,7 @@ async fn launch_approval(
|
||||
"Recovering data.",
|
||||
);
|
||||
|
||||
let timer = metrics.time_recover_and_approve();
|
||||
ctx.send_message(AvailabilityRecoveryMessage::RecoverAvailableData(
|
||||
candidate.clone(),
|
||||
session_index,
|
||||
@@ -1896,6 +1913,8 @@ async fn launch_approval(
|
||||
|
||||
let candidate = candidate.clone();
|
||||
let background = async move {
|
||||
// Force the move of the timer into the background task.
|
||||
let _timer = timer;
|
||||
let _span = jaeger::Span::from_encodable((block_hash, candidate_hash), "launch-approval")
|
||||
.with_relay_parent(block_hash)
|
||||
.with_candidate(candidate_hash)
|
||||
|
||||
Reference in New Issue
Block a user