2024-08-21 17:31:39 +02:00
|
|
|
using NodaTime;
|
2024-08-20 20:19:24 +02:00
|
|
|
using Prometheus;
|
2024-08-15 17:23:56 +02:00
|
|
|
|
|
|
|
|
namespace Catalogger.Backend;
|
|
|
|
|
|
|
|
|
|
public static class CataloggerMetrics
|
|
|
|
|
{
|
2024-08-21 17:31:39 +02:00
|
|
|
public static Instant Startup { get; set; }
|
|
|
|
|
|
2024-10-09 17:35:11 +02:00
|
|
|
public static readonly Gauge MessagesReceived = Metrics.CreateGauge(
|
|
|
|
|
"catalogger_received_messages",
|
|
|
|
|
"Number of messages Catalogger has received"
|
|
|
|
|
);
|
2024-08-15 17:23:56 +02:00
|
|
|
|
2024-08-20 20:19:24 +02:00
|
|
|
public static long MessageRateMinute { get; set; }
|
2024-08-15 17:23:56 +02:00
|
|
|
|
2024-10-09 17:35:11 +02:00
|
|
|
public static readonly Gauge GuildsCached = Metrics.CreateGauge(
|
|
|
|
|
"catalogger_cache_guilds",
|
|
|
|
|
"Number of guilds in the cache"
|
|
|
|
|
);
|
2024-08-16 17:04:24 +02:00
|
|
|
|
2024-10-09 17:35:11 +02:00
|
|
|
public static readonly Gauge ChannelsCached = Metrics.CreateGauge(
|
|
|
|
|
"catalogger_cache_channels",
|
|
|
|
|
"Number of channels in the cache"
|
|
|
|
|
);
|
2024-08-15 17:23:56 +02:00
|
|
|
|
2024-10-09 17:35:11 +02:00
|
|
|
public static readonly Gauge UsersCached = Metrics.CreateGauge(
|
|
|
|
|
"catalogger_cache_users",
|
|
|
|
|
"Number of users in the cache"
|
|
|
|
|
);
|
2024-08-15 17:23:56 +02:00
|
|
|
|
2024-10-09 17:35:11 +02:00
|
|
|
public static readonly Gauge MessagesStored = Metrics.CreateGauge(
|
|
|
|
|
"catalogger_stored_messages",
|
|
|
|
|
"Number of users in the cache"
|
|
|
|
|
);
|
2024-08-16 17:04:24 +02:00
|
|
|
|
2024-10-09 17:35:11 +02:00
|
|
|
public static readonly Summary MetricsCollectionTime = Metrics.CreateSummary(
|
|
|
|
|
"catalogger_time_metrics",
|
|
|
|
|
"Time it took to collect metrics"
|
|
|
|
|
);
|
2024-08-15 17:23:56 +02:00
|
|
|
|
2024-08-20 20:19:24 +02:00
|
|
|
public static Gauge ProcessPhysicalMemory =>
|
|
|
|
|
Metrics.CreateGauge("catalogger_process_physical_memory", "Process physical memory");
|
2024-08-15 17:23:56 +02:00
|
|
|
|
2024-08-20 20:19:24 +02:00
|
|
|
public static Gauge ProcessVirtualMemory =>
|
|
|
|
|
Metrics.CreateGauge("catalogger_process_virtual_memory", "Process virtual memory");
|
2024-08-15 17:23:56 +02:00
|
|
|
|
2024-08-20 20:19:24 +02:00
|
|
|
public static Gauge ProcessPrivateMemory =>
|
|
|
|
|
Metrics.CreateGauge("catalogger_process_private_memory", "Process private memory");
|
2024-08-15 17:23:56 +02:00
|
|
|
|
2024-10-09 17:35:11 +02:00
|
|
|
public static Gauge ProcessThreads =>
|
|
|
|
|
Metrics.CreateGauge("catalogger_process_threads", "Process thread count");
|
2024-08-20 20:19:24 +02:00
|
|
|
|
2024-10-09 17:35:11 +02:00
|
|
|
public static Gauge ProcessHandles =>
|
|
|
|
|
Metrics.CreateGauge("catalogger_process_handles", "Process handle count");
|
|
|
|
|
}
|