aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-04-24 11:10:18 +0100
committerChristopher Baines <mail@cbaines.net>2023-04-24 11:10:18 +0100
commit650fd773f7ffc9e8819e9b3ee47b414cc817bcb3 (patch)
tree2acae254f55d549b715ac0a6fafd2e2a098baa2c
parentef6386aa4eaa72f197256c33aa4f61ba656e934a (diff)
downloadbffe-650fd773f7ffc9e8819e9b3ee47b414cc817bcb3.tar
bffe-650fd773f7ffc9e8819e9b3ee47b414cc817bcb3.tar.gz
Add a gauge for the events channel state id
-rw-r--r--bffe/server.scm17
1 files changed, 13 insertions, 4 deletions
diff --git a/bffe/server.scm b/bffe/server.scm
index 2cc6322..8157843 100644
--- a/bffe/server.scm
+++ b/bffe/server.scm
@@ -121,7 +121,8 @@
(raise-exception exn))
(result result))))
-(define (make-events-channel event-source initial-state-id)
+(define* (make-events-channel event-source initial-state-id
+ #:key metrics-registry)
(let* ((submission-channel (make-channel))
(listener-channels-box (make-atomic-box vlist-null))
@@ -129,7 +130,11 @@
(event-buffer (make-vector buffer-size))
(current-state-id-and-event-buffer-index-box
- (make-atomic-box (cons 0 -1))))
+ (make-atomic-box (cons 0 -1)))
+
+ (events-channel-state-id-gauge
+ (make-gauge-metric metrics-registry
+ "events_channel_state_id")))
(define (get-state-id)
(match (atomic-box-ref
@@ -214,7 +219,10 @@
(vector-set! event-buffer
new-event-index
- (list id event-name data))))))
+ (list id event-name data))
+
+ (metric-set events-channel-state-id-gauge
+ id)))))
(spawn-fiber
(lambda ()
@@ -492,7 +500,8 @@
get-state-id
(make-events-channel
event-source
- initial-state-id))
+ initial-state-id
+ #:metrics-registry metrics-registry))
(controller
(apply make-controller assets-directory
metrics-registry