public InfluxDbAlertingPublisher(IHealthChecksBuilder healthChecksBuilder,
                                  ServiceHealthCheck healthCheck,
                                  AlertTransportSettings alertTransportSettings) :
     base(healthChecksBuilder, healthCheck, alertTransportSettings)
 {
     _influxDBTransportSettings = (InfluxDbTransportSettings)alertTransportSettings;
 }
Esempio n. 2
0
 public CustomNotificationAlertingPublisher(IHealthChecksBuilder healthChecksBuilder,
                                            ServiceHealthCheck healthCheck,
                                            AlertTransportSettings alertTransportSettings) :
     base(healthChecksBuilder, healthCheck, alertTransportSettings)
 {
     _customNotificationTransportSettings = (CustomNotificationTransportSettings)alertTransportSettings;
 }
 public SlackAlertingPublisher(IHealthChecksBuilder healthChecksBuilder,
                               ServiceHealthCheck healthCheck,
                               AlertTransportSettings alertTransportSettings) :
     base(healthChecksBuilder, healthCheck, alertTransportSettings)
 {
     _slackTransportSettings = (SlackTransportSettings)alertTransportSettings;
 }
 public TelegramAlertingPublisher(IHealthChecksBuilder healthChecksBuilder,
                                  ServiceHealthCheck healthCheck,
                                  AlertTransportSettings alertTransportSettings) :
     base(healthChecksBuilder, healthCheck, alertTransportSettings)
 {
     _telegramTransportSettings = (TelegramTransportSettings)alertTransportSettings;
 }
 public DictionaryPublisher(IHealthChecksBuilder healthChecksBuilder,
                            ServiceHealthCheck healthCheck,
                            AlertTransportSettings alertTransportSettings) :
     base(healthChecksBuilder, healthCheck, alertTransportSettings)
 {
     _reportDictionary = new ConcurrentDictionary <DateTime, HealthReport>();
 }
 public EmailAlertingPublisher(IHealthChecksBuilder healthChecksBuilder,
                               ServiceHealthCheck healthCheck,
                               AlertTransportSettings alertTransportSettings) :
     base(healthChecksBuilder, healthCheck, alertTransportSettings)
 {
     _emailTransportSettings = (EmailTransportSettings)alertTransportSettings;
     _mailSenderClient       = new SmtpMailSender(_emailTransportSettings);
     _mailMessageFactory     = new SmtpMailMessageFactory(_emailTransportSettings);
 }
Esempio n. 7
0
 protected PublisherBase(IHealthChecksBuilder healthChecksBuilder,
                         ServiceHealthCheck healthCheck,
                         AlertTransportSettings alertTransportSettings)
 {
     _healthChecksBuilder    = healthChecksBuilder;
     _healthCheck            = healthCheck;
     _alertTransportSettings = alertTransportSettings;
     _observers = new List <IObserver <HealthReport> >();
 }
        public IStackMonitoring AddPublishing(AlertTransportSettings alertTransportSettings, ServiceHealthCheck monitor)
        {
            PublisherBase publisher = null;

            switch (alertTransportSettings)
            {
            case EmailTransportSettings _:
            {
                publisher = new EmailAlertingPublisher(_healthChecksBuilder, monitor, alertTransportSettings);
                lock (_publishers)
                {
                    _publishers.Add(publisher);
                }

                break;
            }

            case InfluxDbTransportSettings _:
            {
                publisher = new InfluxDbAlertingPublisher(_healthChecksBuilder, monitor, alertTransportSettings);
                lock (_publishers)
                {
                    _publishers.Add(publisher);
                }

                break;
            }

            case CustomNotificationTransportSettings _:
            {
                publisher = new CustomNotificationAlertingPublisher(_healthChecksBuilder, monitor, alertTransportSettings);
                lock (_publishers)
                {
                    _publishers.Add(publisher);
                }

                break;
            }

            case TelegramTransportSettings _:
            {
                publisher = new TelegramAlertingPublisher(_healthChecksBuilder, monitor, alertTransportSettings);
                lock (_publishers)
                {
                    _publishers.Add(publisher);
                }

                break;
            }

            case SlackTransportSettings _:
            {
                publisher = new SlackAlertingPublisher(_healthChecksBuilder, monitor, alertTransportSettings);
                lock (_publishers)
                {
                    _publishers.Add(publisher);
                }

                break;
            }
            }

            publisher?.SetUp();

            return(this);
        }