String resolvedMetricsAccountName, String resolvedStorageAccountName) { return IntStream.range(0, canaryConfig.getMetrics().size()) .mapToObj(index -> { CanaryMetricConfig metric = canaryConfig.getMetrics().get(index); String serviceType = metric.getQuery().getServiceType(); CanaryScopeFactory canaryScopeFactory = getScopeFactoryForServiceType(serviceType);
registry.counter(pipelineRunId.withTag("canaryConfigId", canaryConfigId).withTag("canaryConfigName", canaryConfig.getName())).increment(); Set<String> requiredScopes = canaryConfig.getMetrics().stream() .map(CanaryMetricConfig::getScopeName) .filter(Objects::nonNull) resolvedStorageAccountName); int maxMetricIndex = canaryConfig.getMetrics().size() - 1; // 0 based naming, so we want the last index value, not the count String lastControlFetchRefid = CanaryStageNames.REFID_FETCH_CONTROL_PREFIX + maxMetricIndex; String lastExperimentFetchRefid = CanaryStageNames.REFID_FETCH_EXPERIMENT_PREFIX + maxMetricIndex;
CanaryMetricConfig canaryMetricConfig = canaryConfig.getMetrics().get(metricIndex); List<MetricSet> metricSetList = null; int retries = 0;
@Test public void loadConfig() throws Exception { CanaryConfig config = getConfig("com/netflix/kayenta/controllers/sample-config.json"); GraphiteCanaryScope experiment = new GraphiteCanaryScope(); experiment.setStart(Instant.parse("2000-01-01T00:11:22Z")); experiment.setEnd(Instant.parse("2000-01-01T00:15:22Z")); experiment.setScope("staging"); GraphiteCanaryScope control = new GraphiteCanaryScope(); control.setStart(Instant.parse("2000-01-01T00:11:22Z")); control.setEnd(Instant.parse("2000-01-01T00:15:22Z")); control.setScope("prod"); Map<CanaryMetricConfig, List<GraphiteResults>> experimentMetrics = config.getMetrics().stream() .map((metric) -> queryMetric(metric, experiment)) .collect(Collectors.toMap(CanaryMetricConfigWithResults::getCanaryMetricConfig, CanaryMetricConfigWithResults::getGraphiteResults)); Map<CanaryMetricConfig, List<GraphiteResults>> controlMetrics = config.getMetrics().stream() .map((metric) -> queryMetric(metric, control)) .collect(Collectors.toMap(CanaryMetricConfigWithResults::getCanaryMetricConfig, CanaryMetricConfigWithResults::getGraphiteResults)); GraphiteResults experimentResult = Lists.newArrayList(experimentMetrics.values()).get(0).get(0); assertEquals(946685480L, experimentResult.getStart().longValue()); assertEquals(10, experimentResult.getInterval().longValue()); assertEquals(24, experimentResult.getDataPoints().collect(Collectors.toList()).size()); } }
Map<CanaryMetricConfig, List<AtlasResults>> experimentMetrics = config.getMetrics().stream() .map((metric) -> queryMetric(metric, experiment)) .collect(Collectors.toMap(CanaryMetricConfigWithResults::getCanaryMetricConfig, CanaryMetricConfigWithResults::getAtlasResults)); Map<CanaryMetricConfig, List<AtlasResults>> controlMetrics = config.getMetrics().stream() .map((metric) -> queryMetric(metric, control)) .collect(Collectors.toMap(CanaryMetricConfigWithResults::getCanaryMetricConfig,
String resolvedMetricsAccountName, String resolvedStorageAccountName) { return IntStream.range(0, canaryConfig.getMetrics().size()) .mapToObj(index -> { CanaryMetricConfig metric = canaryConfig.getMetrics().get(index); String serviceType = metric.getQuery().getServiceType(); CanaryScopeFactory canaryScopeFactory = getScopeFactoryForServiceType(serviceType);
registry.counter(pipelineRunId.withTag("canaryConfigId", canaryConfigId).withTag("canaryConfigName", canaryConfig.getName())).increment(); Set<String> requiredScopes = canaryConfig.getMetrics().stream() .map(CanaryMetricConfig::getScopeName) .filter(Objects::nonNull) resolvedStorageAccountName); int maxMetricIndex = canaryConfig.getMetrics().size() - 1; // 0 based naming, so we want the last index value, not the count String lastControlFetchRefid = CanaryStageNames.REFID_FETCH_CONTROL_PREFIX + maxMetricIndex; String lastExperimentFetchRefid = CanaryStageNames.REFID_FETCH_EXPERIMENT_PREFIX + maxMetricIndex;
CanaryMetricConfig canaryMetricConfig = canaryConfig.getMetrics().get(metricIndex); List<MetricSet> metricSetList = null; int retries = 0;