Add metrics for group count

This commit is contained in:
Ske 2020-08-25 18:26:30 +02:00
parent 04960067c6
commit 10d6968734
2 changed files with 4 additions and 1 deletions

View File

@ -78,11 +78,12 @@ namespace PluralKit.Bot
_metrics.Measure.Gauge.SetValue(BotMetrics.MembersOnline, usersOnline.Count); _metrics.Measure.Gauge.SetValue(BotMetrics.MembersOnline, usersOnline.Count);
// Aggregate DB stats // Aggregate DB stats
var counts = await _db.Execute(c => c.QueryFirstAsync<Counts>("select (select count(*) from systems) as systems, (select count(*) from members) as members, (select count(*) from switches) as switches, (select count(*) from messages) as messages")); var counts = await _db.Execute(c => c.QueryFirstAsync<Counts>("select (select count(*) from systems) as systems, (select count(*) from members) as members, (select count(*) from switches) as switches, (select count(*) from messages) as messages, (select count(*) from groups) as groups"));
_metrics.Measure.Gauge.SetValue(CoreMetrics.SystemCount, counts.Systems); _metrics.Measure.Gauge.SetValue(CoreMetrics.SystemCount, counts.Systems);
_metrics.Measure.Gauge.SetValue(CoreMetrics.MemberCount, counts.Members); _metrics.Measure.Gauge.SetValue(CoreMetrics.MemberCount, counts.Members);
_metrics.Measure.Gauge.SetValue(CoreMetrics.SwitchCount, counts.Switches); _metrics.Measure.Gauge.SetValue(CoreMetrics.SwitchCount, counts.Switches);
_metrics.Measure.Gauge.SetValue(CoreMetrics.MessageCount, counts.Messages); _metrics.Measure.Gauge.SetValue(CoreMetrics.MessageCount, counts.Messages);
_metrics.Measure.Gauge.SetValue(CoreMetrics.GroupCount, counts.Groups);
// Process info // Process info
var process = Process.GetCurrentProcess(); var process = Process.GetCurrentProcess();
@ -109,6 +110,7 @@ namespace PluralKit.Bot
public int Members { get; } public int Members { get; }
public int Switches { get; } public int Switches { get; }
public int Messages { get; } public int Messages { get; }
public int Groups { get; }
} }
} }
} }

View File

@ -11,6 +11,7 @@ namespace PluralKit.Core
public static GaugeOptions MemberCount => new GaugeOptions { Name = "Members", MeasurementUnit = Unit.Items }; public static GaugeOptions MemberCount => new GaugeOptions { Name = "Members", MeasurementUnit = Unit.Items };
public static GaugeOptions MessageCount => new GaugeOptions { Name = "Messages", MeasurementUnit = Unit.Items }; public static GaugeOptions MessageCount => new GaugeOptions { Name = "Messages", MeasurementUnit = Unit.Items };
public static GaugeOptions SwitchCount => new GaugeOptions { Name = "Switches", MeasurementUnit = Unit.Items }; public static GaugeOptions SwitchCount => new GaugeOptions { Name = "Switches", MeasurementUnit = Unit.Items };
public static GaugeOptions GroupCount => new GaugeOptions { Name = "Groups", MeasurementUnit = Unit.Items };
public static GaugeOptions ProcessPhysicalMemory => new GaugeOptions { Name = "Process Physical Memory", MeasurementUnit = Unit.Bytes, Context = "Process" }; public static GaugeOptions ProcessPhysicalMemory => new GaugeOptions { Name = "Process Physical Memory", MeasurementUnit = Unit.Bytes, Context = "Process" };
public static GaugeOptions ProcessVirtualMemory => new GaugeOptions { Name = "Process Virtual Memory", MeasurementUnit = Unit.Bytes, Context = "Process" }; public static GaugeOptions ProcessVirtualMemory => new GaugeOptions { Name = "Process Virtual Memory", MeasurementUnit = Unit.Bytes, Context = "Process" };