diff --git a/src/metrics.rs b/src/metrics.rs index 219b30c..45c7fc4 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -24,6 +24,9 @@ pub struct Metrics { /// Number of successfully sent heartbeat notifications. pub heartbeat_notifications_total: Counter, + /// Number of heartbeat token registrations. + pub heartbeat_registrations_total: Counter, + /// Number of tokens registered for heartbeat notifications. pub heartbeat_token_count: Gauge, } @@ -46,6 +49,13 @@ impl Metrics { heartbeat_notifications_total.clone(), ); + let heartbeat_registrations_total = Counter::default(); + registry.register( + "heartbeat_registrations", + "Number of heartbeat registrations", + heartbeat_registrations_total.clone(), + ); + let heartbeat_token_count = Gauge::::default(); registry.register( "heartbeat_token_count", @@ -57,6 +67,7 @@ impl Metrics { registry, direct_notifications_total, heartbeat_notifications_total, + heartbeat_registrations_total, heartbeat_token_count, } } diff --git a/src/server.rs b/src/server.rs index 3e05910..6505f56 100644 --- a/src/server.rs +++ b/src/server.rs @@ -33,6 +33,8 @@ async fn register_device(mut req: tide::Request) -> tide::Result