Path: redb-tsak/src/redb.Tsak.Core/Monitoring/Alerts/WatchdogAlertOptions.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Core/Monitoring/Alerts/WatchdogAlertOptions.cs
----
namespace redb.Tsak.Core.Monitoring.Alerts;
///
/// Alert delivery configuration, bound from Tsak:Watchdog:Alerts.
///
/// Everything is off by default: no channel delivers until it is explicitly enabled and
/// given its connection parameters. Enabling alone does nothing — at least
/// one channel must also be enabled.
///
///
public sealed class WatchdogAlertOptions
{
/// Master switch. Default: false.
public bool Enabled { get; set; }
///
/// Minimum severity that triggers delivery: "Suspected" or "Hung".
/// Default: "Hung" — only genuinely stuck exchanges page someone.
///
public string MinLevel { get; set; } = "Hung";
///
/// Suppression window: the same alert (context+route+exchange+level) is delivered at most once
/// per this many minutes, so a persistently hung exchange does not re-page every scan.
/// Default: 15.
///
public double DedupWindowMinutes { get; set; } = 15;
public WebhookChannelOptions Webhook { get; set; } = new();
public TelegramChannelOptions Telegram { get; set; } = new();
public EmailChannelOptions Email { get; set; } = new();
public EndpointChannelOptions Endpoint { get; set; } = new();
}
/// Generic outgoing webhook — POSTs the alert JSON to a URL (Slack/Teams/PagerDuty/…).
public sealed class WebhookChannelOptions
{
public bool Enabled { get; set; }
/// Target URL. Required when enabled.
public string Url { get; set; } = "";
/// Optional extra headers (e.g. an auth token).
public Dictionary Headers { get; set; } = new();
}
/// Telegram Bot API — a formatted HTTPS POST, no connector needed.
public sealed class TelegramChannelOptions
{
public bool Enabled { get; set; }
/// Bot token from @BotFather. Required when enabled.
public string BotToken { get; set; } = "";
/// Target chat id. Required when enabled.
public string ChatId { get; set; } = "";
}
/// Email via SMTP (BCL SmtpClient — no extra package).
public sealed class EmailChannelOptions
{
public bool Enabled { get; set; }
public string Host { get; set; } = "";
public int Port { get; set; } = 587;
public bool UseSsl { get; set; } = true;
public string From { get; set; } = "";
public string To { get; set; } = "";
public string? Username { get; set; }
public string? Password { get; set; }
}
///
/// Generic route endpoint — sends the alert to any redb.Route URI (kafka:topic,
/// amqp:queue, mqtt:…) via a ProducerTemplate. Works only when the matching
/// component is registered in the host's _system context; it is never a compile-time dependency
/// of the Tsak kernel, so brokers add no weight to Core.
///
public sealed class EndpointChannelOptions
{
public bool Enabled { get; set; }
/// Route producer URI, e.g. kafka:tsak-alerts. Required when enabled.
public string Uri { get; set; } = "";
}