Skip to content

Commit 1030bec

Browse files
committed
store: When pushing to the queue, measure how long we were blocked
1 parent a820720 commit 1030bec

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

store/postgres/src/writable.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::ops::{Deref, Range};
33
use std::sync::atomic::{AtomicBool, Ordering};
44
use std::sync::Mutex;
55

6+
use graph::components::metrics::stopwatch::Section;
67
use graph::parking_lot::RwLock;
78
use std::time::Instant;
89
use std::{collections::BTreeMap, sync::Arc};
@@ -865,6 +866,13 @@ impl Request {
865866
Request::RevertTo { .. } | Request::Stop => false,
866867
}
867868
}
869+
870+
fn stopwatch_section(&self, name: &str) -> Option<Section> {
871+
match self {
872+
Request::Write { stopwatch, .. } => Some(stopwatch.start_section(name)),
873+
Request::RevertTo { .. } | Request::Stop => None,
874+
}
875+
}
868876
}
869877

870878
/// A queue that asynchronously writes requests queued with `push` to the
@@ -1205,6 +1213,7 @@ impl Queue {
12051213
self.stopwatch.cheap_clone(),
12061214
batch,
12071215
);
1216+
let _section = req.stopwatch_section("queue_push_blocked");
12081217
self.push(req).await?;
12091218
}
12101219
Ok(())

0 commit comments

Comments
 (0)