Example #1
0
        public static async Task <Watchlist> CreateAsync(ILogger logger, IKustoClient kustoClient, IReadOnlyDictionary <CloudBuildEnvironment, EnvironmentConfiguration> environments)
        {
            var watchlist = new Watchlist(logger, kustoClient, environments);
            await watchlist.RefreshAsync();

            return(watchlist);
        }
 public KustoDataProvider(OperationDataCache cache, KustoDataProviderConfiguration configuration) : base(cache)
 {
     _configuration = configuration;
     _kustoClient   = KustoClientFactory.GetKustoClient(configuration);
     Metadata       = new DataProviderMetadata
     {
         ProviderName = "Kusto"
     };
 }
Example #3
0
 public KustoRuleConfiguration(IClock clock, ILogger logger, INotifier <Notification> notifier, IKustoClient kustoClient, string kustoDatabaseName, string cacheTableName)
 {
     Clock             = clock;
     Logger            = logger;
     Notifier          = notifier;
     KustoClient       = kustoClient;
     KustoDatabaseName = kustoDatabaseName;
     CacheTableName    = cacheTableName;
 }
 public KustoDataProvider(OperationDataCache cache, KustoDataProviderConfiguration configuration, string requestId) : base(cache)
 {
     _configuration = configuration;
     _kustoClient   = KustoClientFactory.GetKustoClient(configuration, requestId);
     _requestId     = requestId;
     Metadata       = new DataProviderMetadata
     {
         ProviderName = "Kusto"
     };
 }
Example #5
0
 public SingleStampRuleConfiguration(
     IClock clock,
     ILogger logger,
     INotifier <Notification> notifier,
     IKustoClient kustoClient,
     IIcmClient icmClient,
     string kustoDatabaseName,
     string cacheTableName,
     StampId stamp)
     : base(clock, logger, notifier, kustoClient, kustoDatabaseName, cacheTableName, icmClient)
 {
     StampId = stamp;
 }
Example #6
0
 public MultiStampRuleConfiguration(
     IClock clock,
     ILogger logger,
     INotifier <Notification> notifier,
     IKustoClient kustoClient,
     IIcmClient icmClient,
     string kustoDatabaseName,
     string cacheTableName,
     MonitorEnvironment environment,
     Watchlist watchlist)
     : base(clock, logger, notifier, kustoClient, kustoDatabaseName, cacheTableName, icmClient)
 {
     Environment = environment;
     WatchList   = watchlist;
 }
Example #7
0
 public SyncKustoTableWorker(
     IKustoClient kustoClient,
     IDocDbClient docDbClient,
     ILoggerFactory loggerFactory,
     IConfiguration configuration)
 {
     _kustoClient    = kustoClient;
     _docDbClient    = docDbClient;
     _logger         = loggerFactory.CreateLogger <SyncKustoTableWorker>();
     _kustoSettings  = configuration.GetConfiguredSettings <KustoSettings>();
     _jsonSerializer = new JsonSerializer();
     _jsonSerializer.Converters.Add(new StringEnumConverter());
     _jsonSerializer.ContractResolver = new DefaultContractResolver()
     {
         NamingStrategy = new CamelCaseNamingStrategy()
         {
             OverrideSpecifiedNames = false
         }
     };
 }
Example #8
0
        private Monitor(Configuration configuration, IKustoIngestClient kustoIngestClient, IKustoClient kustoClient, IClock clock, IReadOnlyDictionary <CloudBuildEnvironment, EnvironmentResources> environmentResources, ILogger logger)
        {
            _configuration = configuration;

            _clock                = clock;
            _logger               = logger;
            _kustoIngestClient    = kustoIngestClient;
            _kustoClient          = kustoClient;
            _environmentResources = environmentResources;

            if (configuration.TestMode)
            {
                _alertNotifier      = new LogWriter <Notification>(_logger);
                _schedulerLogWriter = new LogWriter <RuleScheduler.LogEntry>(_logger);
            }
            else
            {
                _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);
        }
Example #9
0
        public KustoRepo(IServiceProvider serviceProvider, ILoggerFactory loggerFactory)
        {
            logger = loggerFactory.CreateLogger <KustoRepo <T> >();
            var configuration     = serviceProvider.GetRequiredService <IConfiguration>();
            var kustoDataSettings = configuration.GetConfiguredSettings <KustoDataSettings>();
            var prop = kustoDataSettings.GetType().GetProperties()
                       .FirstOrDefault(p =>
            {
                var customAttr = p.GetCustomAttribute <MappedModelAttribute>();
                if (customAttr != null && customAttr.ModelType == typeof(T))
                {
                    return(true);
                }

                return(false);
            });

            if (prop == null)
            {
                throw new Exception($"Missing backend mapping for model: {typeof(T).Name}");
            }
            kustoSettings = prop.GetValue(kustoDataSettings) as KustoSettings;
            kustoClient   = new KustoClient(serviceProvider, loggerFactory, kustoSettings);
        }
 public IngestKustoImageInfoCommand(ILoggerService loggerService, IKustoClient kustoClient)
 {
     this.loggerService = loggerService ?? throw new ArgumentNullException(nameof(loggerService));
     this.kustoClient   = kustoClient ?? throw new ArgumentNullException(nameof(kustoClient));
 }
Example #11
0
 private Watchlist(ILogger logger, IKustoClient kustoClient, IReadOnlyDictionary <CloudBuildEnvironment, EnvironmentConfiguration> environments)
 {
     _logger       = logger;
     _kustoClient  = kustoClient;
     _environments = environments;
 }