Skip to content

Commit 2377c99

Browse files
authored
Merge pull request #1064 from rust-lang/throttling
Track how many people are waiting for a one-off coordinator
2 parents 79529ef + 2bdec1c commit 2377c99

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ui/src/metrics.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ lazy_static! {
1717
vec![0.1, 1.0, 2.5, 5.0, 10.0, 15.0]
1818
)
1919
.unwrap();
20+
pub(crate) static ref ONE_OFF_QUEUE_DEPTH: IntGauge = register_int_gauge!(
21+
"playground_one_off_coordinator_queue_depth",
22+
"Number of clients waiting for a one-off coordinator"
23+
)
24+
.unwrap();
2025
pub(crate) static ref LIVE_WS: IntGauge = register_int_gauge!(
2126
"playground_active_websocket_connections_count",
2227
"Number of active WebSocket connections"

ui/src/server_axum.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{
22
gist,
33
metrics::{
44
record_metric, track_metric_no_request_async, Endpoint, HasLabelsCore, Outcome,
5-
UNAVAILABLE_WS,
5+
ONE_OFF_QUEUE_DEPTH, UNAVAILABLE_WS,
66
},
77
request_database::{Handle, How},
88
sandbox::DOCKER_PROCESS_TIMEOUT_SOFT,
@@ -442,7 +442,9 @@ where
442442
for<'f> F:
443443
FnOnce(&'f coordinator::Coordinator<DockerBackend>, Req) -> BoxFuture<'f, Result<Resp>>,
444444
{
445+
ONE_OFF_QUEUE_DEPTH.inc();
445446
let coordinator = factory.build().await;
447+
ONE_OFF_QUEUE_DEPTH.dec();
446448

447449
let job = async {
448450
let req = req.try_into()?;

0 commit comments

Comments
 (0)