예제 #1
0
        /// <summary>
        /// Schedules a rule to be run over different stamps and environments.
        /// </summary>
        private void OncePerStamp(Func <KustoRuleConfiguration, IEnumerable <Instantiation> > generator)
        {
            Contract.RequiresNotNull(generator);

            foreach (var kvp in Stamps)
            {
                var environment = kvp.Key;
                foreach (var stamp in kvp.Value)
                {
                    var configuration = new KustoRuleConfiguration()
                    {
                        Clock             = _clock,
                        Logger            = _logger,
                        Notifier          = _alertNotifier,
                        CslQueryProvider  = _cslQueryProvider,
                        KustoDatabaseName = EnvironmentToKustoDatabaseName[environment],
                        Environment       = environment,
                        Stamp             = stamp,
                    };

                    foreach (var entry in generator(configuration))
                    {
                        _scheduler.Add(entry.Rule, entry.PollingPeriod, entry.ForceRun);
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Schedules a rule to be run over different stamps and environments.
        /// </summary>
        private void OncePerStamp(Func <RuleGeneratorArguments, IEnumerable <Instantiation> > generator, Watchlist watchlist)
        {
            foreach (var(stampId, properties) in watchlist.Entries)
            {
                var configuration = new KustoRuleConfiguration(
                    _clock,
                    _logger,
                    _alertNotifier,
                    _cslQueryProvider,
                    stampId,
                    _configuration.Environments[stampId.Environment].KustoDatabaseName,
                    properties.CacheTableName);

                var request = new RuleGeneratorArguments
                {
                    StampId = stampId,
                    DynamicStampProperties = properties,
                    BaseConfiguration      = configuration,
                    EnvironmentResources   = _environmentResources[stampId.Environment],
                };

                foreach (var rule in generator(request))
                {
                    Contract.AssertNotNull(rule.Rule);
                    _scheduler.Add(rule.Rule, rule.PollingPeriod, rule.ForceRun);
                }
            }
        }
예제 #3
0
        private void OncePerStamp(Func <KustoRuleConfiguration, IEnumerable <Instantiation> > generator, Watchlist watchlist)
        {
            foreach (var entry in watchlist.Entries)
            {
                var tableNameFound = watchlist.TryGetCacheTableName(entry, out var cacheTableName);
                Contract.Assert(tableNameFound);

                var configuration = new KustoRuleConfiguration()
                {
                    Clock             = _clock,
                    Logger            = _logger,
                    Notifier          = _alertNotifier,
                    CslQueryProvider  = _cslQueryProvider,
                    KustoDatabaseName = EnvironmentToKustoDatabaseName[entry.Environment],
                    Environment       = entry.Environment,
                    Stamp             = entry.Stamp,
                    CacheTableName    = cacheTableName,
                };

                foreach (var rule in generator(configuration))
                {
                    Contract.AssertNotNull(rule.Rule);
                    _scheduler.Add(rule.Rule, rule.PollingPeriod, rule.ForceRun);
                }
            }
        }
예제 #4
0
 public Configuration(KustoRuleConfiguration kustoRuleConfiguration)
     : base(kustoRuleConfiguration)
 {
 }