public async Task GenerateAlarmsFor(WatchmanServiceConfiguration config, RunMode mode) { foreach (var alertingGroup in config.AlertingGroups) { var alarms = await _serviceAlarmBuilder.GenerateAlarmsFor(alertingGroup, config.Defaults); foreach (var alarm in alarms) { _creator.AddAlarm(alarm); } } }
private async Task <List <string> > GenerateAlarms(WatchmanServiceConfiguration <TAlarmConfig> serviceConfig, RunMode mode) { var failures = new List <string>(); foreach (var alertingGroup in serviceConfig.AlertingGroups) { try { var alarmsForGroup = await _serviceAlarmBuilder.GenerateAlarmsFor( alertingGroup.Service, serviceConfig.Defaults, alertingGroup.GroupParameters.AlarmNameSuffix); _creator.AddAlarms(alertingGroup.GroupParameters, alarmsForGroup); } catch (Exception ex) { _logger.Error(ex, $"Failed to generate alarms for group {alertingGroup.GroupParameters.Name}"); failures.Add(alertingGroup.GroupParameters.Name); } } return(failures); }