add metrics (without reporting, for now)

This commit is contained in:
sam 2024-08-15 17:23:56 +02:00
parent 5585ffd6ea
commit 14b132e466
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
9 changed files with 183 additions and 9 deletions

View file

@ -0,0 +1,88 @@
using App.Metrics;
using App.Metrics.Gauge;
using App.Metrics.Meter;
using App.Metrics.Timer;
namespace Catalogger.Backend;
public static class CataloggerMetrics
{
public static MeterOptions MessagesReceived => new()
{
Name = "Messages received",
MeasurementUnit = Unit.Events,
RateUnit = TimeUnit.Seconds,
Context = "Bot"
};
public static GaugeOptions GuildsCached => new()
{
Name = "Guilds cached",
MeasurementUnit = Unit.Items,
Context = "Bot"
};
public static GaugeOptions ChannelsCached => new()
{
Name = "Channels cached",
MeasurementUnit = Unit.Items,
Context = "Bot"
};
public static GaugeOptions UsersCached => new()
{
Name = "Users cached",
MeasurementUnit = Unit.Items,
Context = "Bot"
};
public static GaugeOptions MessagesStored => new()
{
Name = "Messages stored",
MeasurementUnit = Unit.Items,
Context = "Bot"
};
public static TimerOptions MetricsCollectionTime => new()
{
Name = "Metrics collection time",
MeasurementUnit = Unit.Events,
DurationUnit = TimeUnit.Milliseconds,
Context = "Bot"
};
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"
};
}