File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,10 @@ use self::{
3131 constraint_pausing:: { ConstraintDescription , IndexDescription } ,
3232 locking:: LockedMasDatabase ,
3333} ;
34- use crate :: { Progress , telemetry:: WRITER_FLUSH_TIME } ;
34+ use crate :: {
35+ Progress ,
36+ telemetry:: { WRITER_FLUSH_TIME , WRITER_WAIT_TIME } ,
37+ } ;
3538
3639pub mod checks;
3740pub mod locking;
@@ -119,8 +122,12 @@ impl WriterConnectionPool {
119122 + Sync
120123 + ' static ,
121124 {
125+ let start = Instant :: now ( ) ;
122126 match self . connection_rx . recv ( ) . await {
123127 Some ( Ok ( mut connection) ) => {
128+ let elapsed = start. elapsed ( ) ;
129+ WRITER_WAIT_TIME . record ( elapsed. as_millis ( ) . try_into ( ) . unwrap_or ( u64:: MAX ) , & [ ] ) ;
130+
124131 let connection_tx = self . connection_tx . clone ( ) ;
125132 tokio:: task:: spawn (
126133 async move {
Original file line number Diff line number Diff line change @@ -45,6 +45,14 @@ pub static WRITER_FLUSH_TIME: LazyLock<Histogram<u64>> = LazyLock::new(|| {
4545 . build ( )
4646} ) ;
4747
48+ pub static WRITER_WAIT_TIME : LazyLock < Histogram < u64 > > = LazyLock :: new ( || {
49+ METER
50+ . u64_histogram ( "syn2mas.writer.wait_time" )
51+ . with_description ( "Time spent waiting for a writer connection to become available" )
52+ . with_unit ( "ms" )
53+ . build ( )
54+ } ) ;
55+
4856/// Attribute key for syn2mas.entity metrics representing what entity.
4957pub const K_ENTITY : & str = "entity" ;
5058
You can’t perform that action at this time.
0 commit comments