Initial commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using Prometheus;
|
||||
|
||||
namespace MemeVault.Bot.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// Prometheus-метрики Telegram-бота.
|
||||
/// Регистрируется как Singleton; инжектируется в UpdateDispatcher.
|
||||
/// </summary>
|
||||
public sealed class BotMetrics
|
||||
{
|
||||
// Количество полученных апдейтов с разбивкой по типу
|
||||
public readonly Counter UpdatesReceived = Metrics.CreateCounter(
|
||||
"memevault_bot_updates_received_total",
|
||||
"Total Telegram updates received, by type",
|
||||
labelNames: ["update_type"]);
|
||||
|
||||
// Количество успешно обработанных апдейтов
|
||||
public readonly Counter UpdatesProcessed = Metrics.CreateCounter(
|
||||
"memevault_bot_updates_processed_total",
|
||||
"Total Telegram updates processed successfully, by type",
|
||||
labelNames: ["update_type"]);
|
||||
|
||||
// Ошибки при обработке апдейтов
|
||||
public readonly Counter UpdateErrors = Metrics.CreateCounter(
|
||||
"memevault_bot_update_errors_total",
|
||||
"Total errors while processing Telegram updates, by type",
|
||||
labelNames: ["update_type"]);
|
||||
|
||||
// Время обработки одного апдейта
|
||||
public readonly Histogram UpdateDuration = Metrics.CreateHistogram(
|
||||
"memevault_bot_update_duration_seconds",
|
||||
"Time spent processing a single Telegram update",
|
||||
labelNames: ["update_type"],
|
||||
new HistogramConfiguration
|
||||
{
|
||||
Buckets = Histogram.ExponentialBuckets(start: 0.005, factor: 2, count: 10)
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user