diff options
-rw-r--r-- | bffe/server.scm | 17 |
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 |