From d2a25cd162e3e2f3b68f820525982654b93b8d35 Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Sat, 10 May 2025 12:36:48 +0200 Subject: Reintroduce the workpool size metric --- src/proto.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/proto.c b/src/proto.c index c7ffd95..cff3a6a 100644 --- a/src/proto.c +++ b/src/proto.c @@ -144,6 +144,7 @@ int sockaddr_cmp(struct sockaddr* x, struct sockaddr* y) { bool alloc_req(struct dht* dht, uint16_t* reqId) { for(size_t i = 0; i < MAX_INFLIGHT; i++) { if(!dht->reqalloc[i]) { + prom_gauge_inc(requestsInFlight, NULL); dht->reqalloc[i] = true; *reqId = i; return true; @@ -647,6 +648,7 @@ void proto_begin(struct dht* dht, time_t now, struct message** output, const str for(int i = 0; i < MAX_INFLIGHT; i++) { dht->reqalloc[i] = false; } + prom_gauge_set(requestsInFlight, 0, NULL); dbgl_id(&dht->self); @@ -729,6 +731,7 @@ int handle_packet(struct dht* dht, time_t now, enum commandType type, char* tran return 0; } + prom_gauge_inc(requestsInFlight, NULL); dht->requestdata[reqId].fun = NULL; dht->requestdata[reqId].timeout_fun = NULL; dht->requestdata[reqId].timeout = 0; @@ -878,6 +881,7 @@ int proto_run(struct dht* dht, char* buff, size_t recv_len, struct sockaddr_in* return 0; } if(rc != PROTO_EDISC) { + prom_gauge_inc(requestsInFlight, NULL); dht->requestdata[i].fun = NULL; dht->requestdata[i].timeout_fun = NULL; dht->requestdata[i].timeout = 0; -- cgit v1.2.3