2019-07-16 21:59:06 +02:00
|
|
|
using App.Metrics;
|
|
|
|
using App.Metrics.Gauge;
|
2019-07-21 00:01:02 +02:00
|
|
|
using App.Metrics.Meter;
|
2019-08-12 02:05:30 +02:00
|
|
|
using App.Metrics.Timer;
|
2019-07-16 21:59:06 +02:00
|
|
|
|
2021-11-26 21:10:56 -05:00
|
|
|
namespace PluralKit.Core;
|
|
|
|
|
|
|
|
public static class CoreMetrics
|
2019-07-16 21:59:06 +02:00
|
|
|
{
|
2021-11-26 21:10:56 -05:00
|
|
|
public static GaugeOptions SystemCount => new()
|
|
|
|
{
|
|
|
|
Name = "Systems",
|
|
|
|
MeasurementUnit = Unit.Items
|
|
|
|
};
|
|
|
|
|
|
|
|
public static GaugeOptions MemberCount => new()
|
|
|
|
{
|
|
|
|
Name = "Members",
|
|
|
|
MeasurementUnit = Unit.Items
|
|
|
|
};
|
|
|
|
|
|
|
|
public static GaugeOptions MessageCount => new()
|
|
|
|
{
|
|
|
|
Name = "Messages",
|
|
|
|
MeasurementUnit = Unit.Items
|
|
|
|
};
|
|
|
|
|
|
|
|
public static GaugeOptions SwitchCount => new()
|
|
|
|
{
|
|
|
|
Name = "Switches",
|
|
|
|
MeasurementUnit = Unit.Items
|
|
|
|
};
|
|
|
|
|
|
|
|
public static GaugeOptions GroupCount => new()
|
|
|
|
{
|
|
|
|
Name = "Groups",
|
|
|
|
MeasurementUnit = Unit.Items
|
|
|
|
};
|
|
|
|
|
|
|
|
public static GaugeOptions ProcessPhysicalMemory => new()
|
|
|
|
{
|
|
|
|
Name = "Process Physical Memory",
|
|
|
|
MeasurementUnit = Unit.Bytes,
|
|
|
|
Context = "Process"
|
|
|
|
};
|
|
|
|
|
|
|
|
public static GaugeOptions ProcessVirtualMemory => new()
|
|
|
|
{
|
|
|
|
Name = "Process Virtual Memory",
|
|
|
|
MeasurementUnit = Unit.Bytes,
|
|
|
|
Context = "Process"
|
|
|
|
};
|
|
|
|
|
|
|
|
public static GaugeOptions ProcessPrivateMemory => new()
|
|
|
|
{
|
|
|
|
Name = "Process Private Memory",
|
|
|
|
MeasurementUnit = Unit.Bytes,
|
|
|
|
Context = "Process"
|
|
|
|
};
|
|
|
|
|
|
|
|
public static GaugeOptions ProcessThreads => new()
|
|
|
|
{
|
|
|
|
Name = "Process Thread Count",
|
|
|
|
MeasurementUnit = Unit.Threads,
|
|
|
|
Context = "Process"
|
|
|
|
};
|
|
|
|
|
|
|
|
public static GaugeOptions ProcessHandles => new()
|
|
|
|
{
|
|
|
|
Name = "Process Handle Count",
|
|
|
|
MeasurementUnit = Unit.Items,
|
|
|
|
Context = "Process"
|
|
|
|
};
|
|
|
|
|
|
|
|
public static GaugeOptions CpuUsage => new()
|
|
|
|
{
|
|
|
|
Name = "CPU Usage",
|
|
|
|
MeasurementUnit = Unit.Percent,
|
|
|
|
Context = "Process"
|
|
|
|
};
|
|
|
|
|
|
|
|
public static MeterOptions DatabaseRequests => new()
|
|
|
|
{
|
|
|
|
Name = "Database Requests",
|
|
|
|
MeasurementUnit = Unit.Requests,
|
|
|
|
Context = "Database",
|
|
|
|
RateUnit = TimeUnit.Seconds
|
|
|
|
};
|
|
|
|
|
|
|
|
public static TimerOptions DatabaseQuery => new()
|
|
|
|
{
|
|
|
|
Name = "Database Query",
|
|
|
|
MeasurementUnit = Unit.Requests,
|
|
|
|
DurationUnit = TimeUnit.Seconds,
|
|
|
|
RateUnit = TimeUnit.Seconds,
|
|
|
|
Context = "Database"
|
|
|
|
};
|
|
|
|
|
|
|
|
public static GaugeOptions DatabaseConnections => new()
|
|
|
|
{
|
|
|
|
Name = "Database Connections",
|
|
|
|
MeasurementUnit = Unit.Connections,
|
|
|
|
Context = "Database"
|
|
|
|
};
|
2022-03-23 20:35:40 -04:00
|
|
|
public static GaugeOptions DatabaseConnectionsByCluster => new()
|
|
|
|
{
|
|
|
|
Name = "Database Connections by Cluster",
|
|
|
|
MeasurementUnit = Unit.Connections,
|
|
|
|
Context = "Database"
|
|
|
|
};
|
2022-03-14 23:33:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public record ClusterMetricInfo
|
|
|
|
{
|
|
|
|
public int GuildCount;
|
|
|
|
public int ChannelCount;
|
|
|
|
public int DatabaseConnectionCount;
|
|
|
|
public int WebhookCacheSize;
|
2019-07-16 21:59:06 +02:00
|
|
|
}
|