From 441bdca00a93a80150fe8ba3c7402e14d7b3d511 Mon Sep 17 00:00:00 2001 From: Nastya Smirnova Date: Tue, 4 Feb 2020 17:57:04 +0200 Subject: [PATCH] feat(core): update swagger docs for CanaryClassifierConfig,CanaryClassifierThresholdsConfig, CanaryJudgeConfig, CanaryAnalysisExecutionRequestScope (#667) --- .../canary/CanaryClassifierConfig.java | 16 ++++++++++++-- .../CanaryClassifierThresholdsConfig.java | 17 +++++++++++++-- .../kayenta/canary/CanaryJudgeConfig.java | 21 +++++++++++++++++-- .../CanaryAnalysisExecutionRequestScope.java | 2 +- 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierConfig.java b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierConfig.java index 9afd6590c..2a47d5ace 100644 --- a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierConfig.java +++ b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierConfig.java @@ -17,6 +17,8 @@ package com.netflix.kayenta.canary; import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.util.Map; import javax.validation.constraints.NotNull; import lombok.*; @@ -26,9 +28,19 @@ @NoArgsConstructor @AllArgsConstructor @JsonInclude(JsonInclude.Include.NON_NULL) +@ApiModel(description = "The classification configuration, such as group weights.") public class CanaryClassifierConfig { - @NotNull @Singular @Getter private Map groupWeights; + @ApiModelProperty( + value = + "List of each metrics group along with its corresponding weight. Weights must total 100.", + example = "{\"pod-group\": 70, \"app-group\": 30}") + @NotNull + @Singular + @Getter + private Map groupWeights; - @Getter private CanaryClassifierThresholdsConfig scoreThresholds; + @ApiModelProperty(hidden = true) + @Getter + private CanaryClassifierThresholdsConfig scoreThresholds; } diff --git a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierThresholdsConfig.java b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierThresholdsConfig.java index d92015306..6fbf3f6b0 100644 --- a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierThresholdsConfig.java +++ b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierThresholdsConfig.java @@ -17,6 +17,8 @@ package com.netflix.kayenta.canary; import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.NotNull; import lombok.*; @@ -25,9 +27,20 @@ @NoArgsConstructor @AllArgsConstructor @JsonInclude(JsonInclude.Include.NON_NULL) +@ApiModel(description = "Sets thresholds for canary score.") public class CanaryClassifierThresholdsConfig { - @NotNull @Getter private Double pass; + @ApiModelProperty( + value = "If canary score is higher than this value -- canary is considered successful.", + example = "75.0") + @NotNull + @Getter + private Double pass; - @NotNull @Getter private Double marginal; + @ApiModelProperty( + value = "If canary score is lower than this value -- canary is considered marginal (failed).", + example = "50.0") + @NotNull + @Getter + private Double marginal; } diff --git a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryJudgeConfig.java b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryJudgeConfig.java index ec1565b16..ecb386087 100644 --- a/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryJudgeConfig.java +++ b/kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryJudgeConfig.java @@ -17,6 +17,8 @@ package com.netflix.kayenta.canary; import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.util.Map; import javax.validation.constraints.NotNull; import lombok.*; @@ -26,9 +28,24 @@ @NoArgsConstructor @AllArgsConstructor @JsonInclude(JsonInclude.Include.NON_NULL) +@ApiModel(description = "Judge configuration.") public class CanaryJudgeConfig { - @NotNull @Getter private String name; + @ApiModelProperty( + value = "Judge to use, as of right now there is only `NetflixACAJudge-v1.0`.", + example = "NetflixACAJudge-v1.0", + required = true) + @NotNull + @Getter + private String name; - @NotNull @Singular @Getter private Map judgeConfigurations; + @ApiModelProperty( + value = + "Additional judgement configuration. As of right now, this should always be an empty object.", + example = "{}", + required = true) + @NotNull + @Singular + @Getter + private Map judgeConfigurations; } diff --git a/kayenta-core/src/main/java/com/netflix/kayenta/domain/standalonecanaryanalysis/CanaryAnalysisExecutionRequestScope.java b/kayenta-core/src/main/java/com/netflix/kayenta/domain/standalonecanaryanalysis/CanaryAnalysisExecutionRequestScope.java index 78d0050cd..1e873cfe3 100644 --- a/kayenta-core/src/main/java/com/netflix/kayenta/domain/standalonecanaryanalysis/CanaryAnalysisExecutionRequestScope.java +++ b/kayenta-core/src/main/java/com/netflix/kayenta/domain/standalonecanaryanalysis/CanaryAnalysisExecutionRequestScope.java @@ -39,7 +39,7 @@ public class CanaryAnalysisExecutionRequestScope { @Builder.Default - @ApiModelProperty(value = "TODO: needs to be updated", example = "default") + @ApiModelProperty(value = "Specifies unique name of the metrics scope.", example = "default") String scopeName = "default"; @ApiModelProperty(