Skip to content

Commit 511a6a1

Browse files
jsdtjoshua-spacetime
authored andcommitted
Bring back queue length stats.
1 parent a46d9f0 commit 511a6a1

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

crates/core/src/host/module_host.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,17 @@ impl ModuleHost {
653653
.reducer_wait_time
654654
.with_label_values(&self.info.database_identity, reducer)
655655
.start_timer();
656+
let queue_length_gauge = WORKER_METRICS
657+
.instance_queue_length
658+
.with_label_values(&self.info.database_identity);
659+
queue_length_gauge.inc();
660+
{
661+
let queue_length = queue_length_gauge.get();
662+
WORKER_METRICS
663+
.instance_queue_length_histogram
664+
.with_label_values(&self.info.database_identity)
665+
.observe(queue_length as f64);
666+
}
656667

657668
// Operations on module instances (e.g. calling reducers) is blocking,
658669
// partially because the computation can potentialyl take a long time
@@ -671,6 +682,7 @@ impl ModuleHost {
671682
.job_tx
672683
.run(move |inst| {
673684
queue_timer.stop_and_record();
685+
queue_length_gauge.dec();
674686
f(inst)
675687
})
676688
.await;

0 commit comments

Comments
 (0)