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::{
31
31
constraint_pausing:: { ConstraintDescription , IndexDescription } ,
32
32
locking:: LockedMasDatabase ,
33
33
} ;
34
- use crate :: { Progress , telemetry:: WRITER_FLUSH_TIME } ;
34
+ use crate :: {
35
+ Progress ,
36
+ telemetry:: { WRITER_FLUSH_TIME , WRITER_WAIT_TIME } ,
37
+ } ;
35
38
36
39
pub mod checks;
37
40
pub mod locking;
@@ -119,8 +122,12 @@ impl WriterConnectionPool {
119
122
+ Sync
120
123
+ ' static ,
121
124
{
125
+ let start = Instant :: now ( ) ;
122
126
match self . connection_rx . recv ( ) . await {
123
127
Some ( Ok ( mut connection) ) => {
128
+ let elapsed = start. elapsed ( ) ;
129
+ WRITER_WAIT_TIME . record ( elapsed. as_millis ( ) . try_into ( ) . unwrap_or ( u64:: MAX ) , & [ ] ) ;
130
+
124
131
let connection_tx = self . connection_tx . clone ( ) ;
125
132
tokio:: task:: spawn (
126
133
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(|| {
45
45
. build ( )
46
46
} ) ;
47
47
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
+
48
56
/// Attribute key for syn2mas.entity metrics representing what entity.
49
57
pub const K_ENTITY : & str = "entity" ;
50
58
You can’t perform that action at this time.
0 commit comments