예제 #1
0
        private Monitor(Configuration configuration, IKustoIngestClient kustoIngestClient, ICslQueryProvider cslQueryProvider, IClock clock, IReadOnlyDictionary <CloudBuildEnvironment, EnvironmentResources> environmentResources, ILogger logger)
        {
            _configuration = configuration;

            _clock                = clock;
            _logger               = logger;
            _kustoIngestClient    = kustoIngestClient;
            _cslQueryProvider     = cslQueryProvider;
            _environmentResources = environmentResources;

            _alertNotifier = new KustoWriter <Notification>(_configuration.KustoNotifier, _logger, _kustoIngestClient);

            _schedulerLogWriter = new KustoWriter <RuleScheduler.LogEntry>(_configuration.SchedulerKustoNotifier, _logger, _kustoIngestClient);

            _scheduler = new RuleScheduler(_configuration.Scheduler, _logger, _clock, _schedulerLogWriter);
        }
예제 #2
0
        private Monitor(Configuration configuration, IKustoIngestClient kustoIngestClient, IIcmClient icmClient, IClock clock, IReadOnlyDictionary <MonitorEnvironment, EnvironmentResources> environmentResources, ILogger logger)
        {
            _configuration = configuration;

            _clock                = clock;
            _logger               = logger;
            _kustoIngestClient    = kustoIngestClient;
            _icmClient            = icmClient;
            _environmentResources = environmentResources;

            if (configuration.ReadOnly)
            {
                _alertNotifier      = new LogNotifier <Notification>(_logger);
                _schedulerLogWriter = new LogNotifier <RuleScheduler.LogEntry>(_logger);
            }
            else
            {
                _alertNotifier      = new KustoNotifier <Notification>(_configuration.KustoNotifier, _logger, _kustoIngestClient);
                _schedulerLogWriter = new KustoNotifier <RuleScheduler.LogEntry>(_configuration.SchedulerKustoNotifier, _logger, _kustoIngestClient);
            }

            _scheduler = new RuleScheduler(_configuration.Scheduler, _logger, _clock, _schedulerLogWriter);
        }