Skip to content

Commit

Permalink
Add a metric for the size of the isolate pool (#33629)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: b93c1eaf4410e216b826f38a2399cfea0ecc7081
  • Loading branch information
goffrie authored and Convex, Inc. committed Jan 24, 2025
1 parent 73ae005 commit 4418308
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/isolate/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ use crate::{
metrics::{
self,
log_aggregated_heap_stats,
log_pool_max,
log_pool_running_count,
log_worker_stolen,
queue_timer,
Expand Down Expand Up @@ -1153,6 +1154,7 @@ impl<RT: Runtime, W: IsolateWorker<RT>> SharedIsolateScheduler<RT, W> {
}

pub async fn run(mut self, receiver: CoDelQueueReceiver<RT, Request<RT>>) {
log_pool_max(self.worker.config().name, self.max_workers);
let mut receiver = receiver.fuse();
let mut report_stats = self.rt.wait(*HEAP_WORKER_REPORT_INTERVAL_SECONDS);
loop {
Expand Down
13 changes: 13 additions & 0 deletions crates/isolate/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ pub fn log_pool_running_count(name: &'static str, count: usize, client_id: &str)
);
}

register_convex_gauge!(
ISOLATE_POOL_MAX_INFO,
"How many isolate workers can be running",
&["pool_name"]
);
pub fn log_pool_max(name: &'static str, count: usize) {
log_gauge_with_labels(
&ISOLATE_POOL_MAX_INFO,
count as f64,
vec![StaticMetricLabel::new("pool_name", name)],
);
}

register_convex_gauge!(
ISOLATE_POOL_ALLOCATED_COUNT_INFO,
"How many isolate workers have been allocated",
Expand Down

0 comments on commit 4418308

Please sign in to comment.