From 81cc1465cd4bd03963d77952a6dc6757cd2e87da Mon Sep 17 00:00:00 2001 From: spiral Date: Wed, 23 Mar 2022 20:28:56 -0400 Subject: [PATCH] feat: also report database connection count by cluster in scheduled tasks worker --- PluralKit.ScheduledTasks/TaskHandler.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PluralKit.ScheduledTasks/TaskHandler.cs b/PluralKit.ScheduledTasks/TaskHandler.cs index cff18042..2fe44670 100644 --- a/PluralKit.ScheduledTasks/TaskHandler.cs +++ b/PluralKit.ScheduledTasks/TaskHandler.cs @@ -94,6 +94,13 @@ public class TaskHandler // this is pretty much always inaccurate but oh well _metrics.Measure.Gauge.SetValue(CoreMetrics.DatabaseConnections, stats.Sum(x => x.DatabaseConnectionCount)); + foreach (var stat in redisStats) + _metrics.Measure.Gauge.SetValue( + CoreMetrics.DatabaseConnectionsByCluster, + new MetricTags("cluster_id", stat.Name), + JsonConvert.DeserializeObject(stat.Value).DatabaseConnectionCount + ); + // Other shiz _metrics.Measure.Gauge.SetValue(Metrics.WebhookCacheSize, stats.Sum(x => x.WebhookCacheSize));