feat: replace App.Metrics with prometheus-net
This commit is contained in:
parent
df8af75dd4
commit
be01fb1d53
8 changed files with 113 additions and 137 deletions
|
|
@ -1,88 +1,39 @@
|
|||
using App.Metrics;
|
||||
using App.Metrics.Gauge;
|
||||
using App.Metrics.Meter;
|
||||
using App.Metrics.Timer;
|
||||
using Prometheus;
|
||||
|
||||
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 readonly Gauge MessagesReceived =
|
||||
Metrics.CreateGauge("catalogger_received_messages", "Number of messages Catalogger has received");
|
||||
|
||||
public static GaugeOptions GuildsCached => new()
|
||||
{
|
||||
Name = "Guilds cached",
|
||||
MeasurementUnit = Unit.Items,
|
||||
Context = "Bot"
|
||||
};
|
||||
public static long MessageRateMinute { get; set; }
|
||||
|
||||
public static GaugeOptions ChannelsCached => new()
|
||||
{
|
||||
Name = "Channels cached",
|
||||
MeasurementUnit = Unit.Items,
|
||||
Context = "Bot"
|
||||
};
|
||||
public static readonly Gauge GuildsCached =
|
||||
Metrics.CreateGauge("catalogger_cache_guilds", "Number of guilds in the cache");
|
||||
|
||||
public static GaugeOptions UsersCached => new()
|
||||
{
|
||||
Name = "Users cached",
|
||||
MeasurementUnit = Unit.Items,
|
||||
Context = "Bot"
|
||||
};
|
||||
public static readonly Gauge ChannelsCached =
|
||||
Metrics.CreateGauge("catalogger_cache_channels", "Number of channels in the cache");
|
||||
|
||||
public static GaugeOptions MessagesStored => new()
|
||||
{
|
||||
Name = "Messages stored",
|
||||
MeasurementUnit = Unit.Items,
|
||||
Context = "Bot"
|
||||
};
|
||||
public static readonly Gauge UsersCached =
|
||||
Metrics.CreateGauge("catalogger_cache_users", "Number of users in the cache");
|
||||
|
||||
public static TimerOptions MetricsCollectionTime => new()
|
||||
{
|
||||
Name = "Metrics collection time",
|
||||
MeasurementUnit = Unit.Events,
|
||||
DurationUnit = TimeUnit.Milliseconds,
|
||||
Context = "Bot"
|
||||
};
|
||||
public static readonly Gauge MessagesStored =
|
||||
Metrics.CreateGauge("catalogger_stored_messages", "Number of users in the cache");
|
||||
|
||||
public static GaugeOptions ProcessPhysicalMemory => new()
|
||||
{
|
||||
Name = "Process physical memory",
|
||||
MeasurementUnit = Unit.Bytes,
|
||||
Context = "Process"
|
||||
};
|
||||
public static readonly Summary MetricsCollectionTime =
|
||||
Metrics.CreateSummary("catalogger_time_metrics", "Time it took to collect metrics");
|
||||
|
||||
public static GaugeOptions ProcessVirtualMemory => new()
|
||||
{
|
||||
Name = "Process virtual memory",
|
||||
MeasurementUnit = Unit.Bytes,
|
||||
Context = "Process"
|
||||
};
|
||||
public static Gauge ProcessPhysicalMemory =>
|
||||
Metrics.CreateGauge("catalogger_process_physical_memory", "Process physical memory");
|
||||
|
||||
public static GaugeOptions ProcessPrivateMemory => new()
|
||||
{
|
||||
Name = "Process private memory",
|
||||
MeasurementUnit = Unit.Bytes,
|
||||
Context = "Process"
|
||||
};
|
||||
public static Gauge ProcessVirtualMemory =>
|
||||
Metrics.CreateGauge("catalogger_process_virtual_memory", "Process virtual memory");
|
||||
|
||||
public static GaugeOptions ProcessThreads => new()
|
||||
{
|
||||
Name = "Process thread count",
|
||||
MeasurementUnit = Unit.Threads,
|
||||
Context = "Process"
|
||||
};
|
||||
public static Gauge ProcessPrivateMemory =>
|
||||
Metrics.CreateGauge("catalogger_process_private_memory", "Process private memory");
|
||||
|
||||
public static GaugeOptions ProcessHandles => new()
|
||||
{
|
||||
Name = "Process handle count",
|
||||
MeasurementUnit = Unit.Items,
|
||||
Context = "Process"
|
||||
};
|
||||
public static Gauge ProcessThreads => Metrics.CreateGauge("catalogger_process_threads", "Process thread count");
|
||||
|
||||
public static Gauge ProcessHandles => Metrics.CreateGauge("catalogger_process_handles", "Process handle count");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue