private async Task LogQueueNames() { var queueNames = await _queueSource.GetResourceNamesAsync(); if (queueNames == null) { _logger.Info("No queues found"); return; } _logger.Info($"Preloaded all {queueNames.Count} queues"); foreach (var queueName in queueNames) { _logger.Detail(queueName); } }
private async Task LogTableNames() { var tableNames = await _tableSource.GetResourceNamesAsync(); if (tableNames == null) { _logger.Info("No tables found"); return; } _logger.Info($"Preloaded all {tableNames.Count} tables"); foreach (var tableName in tableNames) { _logger.Detail(tableName); } }
public async Task <OrphansModel> FindOrphanTables(WatchmanConfiguration config) { var monitoredTables = config.AlertingGroups .Where(ag => !ag.IsCatchAll && ag.DynamoDb?.Tables != null) .SelectMany(ag => ag.DynamoDb.Tables) .Select(t => t.Name) .Distinct(); var allTables = await _tableSource.GetResourceNamesAsync(); var unMonitoredTables = allTables .Except(monitoredTables) .OrderBy(t => t) .ToList(); return(new OrphansModel { Items = unMonitoredTables.ToList(), ServiceName = "table" }); }
public async Task <OrphansModel> FindOrphans(string serviceName, IEnumerable <PopulatedServiceAlertingGroup <TConfig, T> > alertingGroups) { var monitoredResources = alertingGroups .Where(ag => !ag.GroupParameters.IsCatchAll) .SelectMany(ag => ag.Service.Resources) .Select(t => t.Resource.Name) .Distinct(); var allResources = await _source.GetResourceNamesAsync(); var unMonitored = allResources .Except(monitoredResources) .OrderBy(t => t); return(new OrphansModel { Items = unMonitored.ToList(), ServiceName = serviceName }); }
private async Task <IList <Table> > GetPatternMatches(Table tablePattern, string alertingGroupName) { var tableNames = await _tableSource.GetResourceNamesAsync(); var matches = tableNames .WhereRegexIsMatch(tablePattern.Pattern) .Select(tn => PatternToTable(tablePattern, tn)) .ToList(); if (matches.Count == 0) { _logger.Info($"{alertingGroupName} pattern '{tablePattern.Pattern}' matched no table names"); } else if (matches.Count == tableNames.Count) { _logger.Info($"{alertingGroupName} pattern '{tablePattern.Pattern}' matched all table names"); } else { _logger.Detail($"{alertingGroupName} pattern '{tablePattern.Pattern}' matched {matches.Count} of {tableNames.Count} table names"); } return(matches); }
private async Task <IList <ResourceThresholds <TConfig> > > GetPatternMatches(ResourceThresholds <TConfig> resourcePattern, string alertingGroupName) { var tableNames = await _resourceSource.GetResourceNamesAsync(); var matches = tableNames .WhereRegexIsMatch(resourcePattern.Pattern) .Select(tn => PatternToTable(resourcePattern, tn)) .ToList(); if (matches.Count == 0) { _logger.Info($"{alertingGroupName} pattern '{resourcePattern.Pattern}' matched no resource names"); } else if (matches.Count == tableNames.Count) { _logger.Info($"{alertingGroupName} pattern '{resourcePattern.Pattern}' matched all resource names"); } else { _logger.Info($"{alertingGroupName} pattern '{resourcePattern.Pattern}' matched {matches.Count} of {tableNames.Count} resource names"); } return(matches); }