public TaskResult execute(@Nonnull Stage stage) { MonitorKayentaCanaryContext context = stage.mapTo(MonitorKayentaCanaryContext.class); String resolvedStorageAccountName = CredentialsHelper.resolveAccountByNameOrType(context.getStorageAccountName(), AccountCredentials.Type.OBJECT_STORE, accountCredentialsRepository); Execution pipeline = executionRepository.retrieve(Execution.ExecutionType.PIPELINE, context.getCanaryPipelineExecutionId()); if (canaryScore <= context.getScoreThresholds().getMarginal()) { resultStatus = TERMINAL; resultContext.put("canaryScoreMessage", "Canary score is not above the marginal score threshold.");
/** * Generates warnings that will be propigated in the aggregated results. */ protected List<String> getResultsWarnings(MonitorKayentaCanaryContext context, CanaryExecutionStatusResponse statusResponse) { List<String> warnings = new LinkedList<>(); String credentialType = ""; if (context.getMetricsAccountName() != null) { Set<? extends AccountCredentials> allCredentials = accountCredentialsRepository.getAll(); Optional<? extends AccountCredentials> credential = allCredentials.stream() .filter(cred -> cred.getName().equals(context.getMetricsAccountName())) .findAny(); if (credential.isPresent()) { credentialType = credential.get().getType(); } } // Datadog doesn't return data points in the same way as other metrics providers // and so are excluded here. See this Github comment for more information: // https://github.com/spinnaker/kayenta/issues/283#issuecomment-397346975 final ObjectMapper om = new ObjectMapper(); if (! credentialType.equals("datadog") && statusResponse.getResult().getJudgeResult().getResults().stream() .anyMatch(canaryAnalysisResult -> om.convertValue(canaryAnalysisResult.getControlMetadata().get("stats"), Stats.class).getCount() < 50)) { warnings.add("One of the metrics returned fewer than 50 data points, which can reduce confidence in the final canary score."); } return warnings; } }
public TaskResult execute(@Nonnull Stage stage) { MonitorKayentaCanaryContext context = stage.mapTo(MonitorKayentaCanaryContext.class); String resolvedStorageAccountName = CredentialsHelper.resolveAccountByNameOrType(context.getStorageAccountName(), AccountCredentials.Type.OBJECT_STORE, accountCredentialsRepository); Execution pipeline = executionRepository.retrieve(Execution.ExecutionType.PIPELINE, context.getCanaryPipelineExecutionId()); if (canaryScore <= context.getScoreThresholds().getMarginal()) { resultStatus = TERMINAL; resultContext.put("canaryScoreMessage", "Canary score is not above the marginal score threshold.");
/** * Generates warnings that will be propigated in the aggregated results. */ protected List<String> getResultsWarnings(MonitorKayentaCanaryContext context, CanaryExecutionStatusResponse statusResponse) { List<String> warnings = new LinkedList<>(); String credentialType = ""; if (context.getMetricsAccountName() != null) { Set<? extends AccountCredentials> allCredentials = accountCredentialsRepository.getAll(); Optional<? extends AccountCredentials> credential = allCredentials.stream() .filter(cred -> cred.getName().equals(context.getMetricsAccountName())) .findAny(); if (credential.isPresent()) { credentialType = credential.get().getType(); } } // Datadog doesn't return data points in the same way as other metrics providers // and so are excluded here. See this Github comment for more information: // https://github.com/spinnaker/kayenta/issues/283#issuecomment-397346975 final ObjectMapper om = new ObjectMapper(); if (! credentialType.equals("datadog") && statusResponse.getResult().getJudgeResult().getResults().stream() .anyMatch(canaryAnalysisResult -> om.convertValue(canaryAnalysisResult.getControlMetadata().get("stats"), Stats.class).getCount() < 50)) { warnings.add("One of the metrics returned fewer than 50 data points, which can reduce confidence in the final canary score."); } return warnings; } }