accountCredentialsRepository); return synchronousQueryProcessor.executeQueryAndProduceTaskResult(resolvedMetricsAccountName, resolvedStorageAccountName, canaryConfig,
public TaskResult executeQueryAndProduceTaskResult(String metricsAccountName, String storageAccountName, CanaryConfig canaryConfig, int metricIndex, CanaryScope canaryScope) { try { Map outputs = processQueryAndReturnMap(metricsAccountName, storageAccountName, canaryConfig, null /* canaryMetricConfig */, metricIndex, canaryScope, false /* dryRun */); return new TaskResult(ExecutionStatus.SUCCEEDED, Collections.emptyMap(), outputs); } catch (IOException e) { throw new RuntimeException(e); } } }
public Map processQueryAndReturnMap(String metricsAccountName, String storageAccountName, CanaryConfig canaryConfig, CanaryMetricConfig canaryMetricConfig, int metricIndex, CanaryScope canaryScope, boolean dryRun) throws IOException { if (canaryConfig == null) { canaryConfig = CanaryConfig.builder().metric(canaryMetricConfig).build(); } if (dryRun) { MetricsService metricsService = metricsServiceRepository .getOne(metricsAccountName) .orElseThrow(() -> new IllegalArgumentException("No metrics service was configured; unable to read from metrics store.")); String query = metricsService.buildQuery(metricsAccountName, canaryConfig, canaryMetricConfig, canaryScope); return Collections.singletonMap("query", query); } else { String metricSetListId = executeQuery(metricsAccountName, storageAccountName, canaryConfig, metricIndex, canaryScope); return Collections.singletonMap("metricSetListId", metricSetListId); } }
); return synchronousQueryProcessor.executeQueryAndProduceTaskResult( resolvedMetricsAccountName, resolvedStorageAccountName,
Instant.parse(end), null, Collections.EMPTY_MAP); return synchronousQueryProcessor.processQueryAndReturnMap( resolvedMetricsAccountName, resolvedStorageAccountName,
String metricSetListId = synchronousQueryProcessor.executeQuery(resolvedMetricsAccountName, resolvedStorageAccountName, CanaryConfig.builder().metric(canaryMetricConfig).build(),
); return synchronousQueryProcessor.executeQueryAndProduceTaskResult( resolvedMetricsAccountName, resolvedStorageAccountName,
.processQueryAndReturnMap(resolvedMetricsAccountName, resolvedStorageAccountName, null, canaryMetricConfig, 0, canaryScope, dryRun);
atlasCanaryScope.setStep(step); String metricSetListId = synchronousQueryProcessor.executeQuery(resolvedMetricsAccountName, resolvedStorageAccountName, CanaryConfig.builder().metric(canaryMetricConfig).build(),
@Nonnull @Override public TaskResult execute(@Nonnull Stage stage) { Map<String, Object> context = stage.getContext(); String metricsAccountName = (String)context.get("metricsAccountName"); String storageAccountName = (String)context.get("storageAccountName"); Map<String, Object> canaryConfigMap = (Map<String, Object>)context.get("canaryConfig"); CanaryConfig canaryConfig = kayentaObjectMapper.convertValue(canaryConfigMap, CanaryConfig.class); int metricIndex = (Integer)stage.getContext().get("metricIndex"); CanaryScope canaryScope; try { canaryScope = kayentaObjectMapper.readValue((String)stage.getContext().get("canaryScope"), PrometheusCanaryScope.class); } catch (IOException e) { log.warn("Unable to parse JSON scope", e); throw new RuntimeException(e); } String resolvedMetricsAccountName = CredentialsHelper.resolveAccountByNameOrType(metricsAccountName, AccountCredentials.Type.METRICS_STORE, accountCredentialsRepository); String resolvedStorageAccountName = CredentialsHelper.resolveAccountByNameOrType(storageAccountName, AccountCredentials.Type.OBJECT_STORE, accountCredentialsRepository); return synchronousQueryProcessor.executeQueryAndProduceTaskResult(resolvedMetricsAccountName, resolvedStorageAccountName, canaryConfig, metricIndex, canaryScope); } }
canaryScope.setEnd(end != null ? Instant.parse(end) : null); return synchronousQueryProcessor.processQueryAndReturnMap(resolvedMetricsAccountName, resolvedStorageAccountName, null,
public Map processQueryAndReturnMap(String metricsAccountName, String storageAccountName, CanaryConfig canaryConfig, CanaryMetricConfig canaryMetricConfig, int metricIndex, CanaryScope canaryScope, boolean dryRun) throws IOException { if (canaryConfig == null) { canaryConfig = CanaryConfig.builder().metric(canaryMetricConfig).build(); } if (dryRun) { MetricsService metricsService = metricsServiceRepository .getOne(metricsAccountName) .orElseThrow(() -> new IllegalArgumentException("No metrics service was configured; unable to read from metrics store.")); String query = metricsService.buildQuery(metricsAccountName, canaryConfig, canaryMetricConfig, canaryScope); return Collections.singletonMap("query", query); } else { String metricSetListId = executeQuery(metricsAccountName, storageAccountName, canaryConfig, metricIndex, canaryScope); return Collections.singletonMap("metricSetListId", metricSetListId); } }
); return synchronousQueryProcessor.executeQueryAndProduceTaskResult( resolvedMetricsAccountName, resolvedStorageAccountName,
return synchronousQueryProcessor.processQueryAndReturnMap(resolvedMetricsAccountName, resolvedStorageAccountName, null,
String metricSetListId = synchronousQueryProcessor.executeQuery(resolvedMetricsAccountName, resolvedStorageAccountName, CanaryConfig.builder().metric(canaryMetricConfig).build(),
); return synchronousQueryProcessor.executeQueryAndProduceTaskResult( resolvedMetricsAccountName, resolvedStorageAccountName,
return synchronousQueryProcessor.processQueryAndReturnMap(resolvedMetricsAccountName, resolvedStorageAccountName, null,
atlasCanaryScope.setStep(step); String metricSetListId = synchronousQueryProcessor.executeQuery(resolvedMetricsAccountName, resolvedStorageAccountName, CanaryConfig.builder().metric(canaryMetricConfig).build(),
); return synchronousQueryProcessor.executeQueryAndProduceTaskResult( resolvedMetricsAccountName, resolvedStorageAccountName,
public TaskResult executeQueryAndProduceTaskResult(String metricsAccountName, String storageAccountName, CanaryConfig canaryConfig, int metricIndex, CanaryScope canaryScope) { try { Map outputs = processQueryAndReturnMap(metricsAccountName, storageAccountName, canaryConfig, null /* canaryMetricConfig */, metricIndex, canaryScope, false /* dryRun */); return new TaskResult(ExecutionStatus.SUCCEEDED, Collections.emptyMap(), outputs); } catch (IOException e) { throw new RuntimeException(e); } } }