Skip to content

Commit

Permalink
chore(canary-v2): Update to new json-based initiate canary entrypoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Duftler committed Oct 31, 2017
1 parent 20b2847 commit 4decfc8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,12 @@ import retrofit.http.*

interface KayentaService {

@POST("/canary")
Response create(@Query("metricsAccountName") String metricsAccountName,
@Query("storageAccountName") String storageAccountName,
@Query("canaryConfigId") String canaryConfigId,
@Query("controlScope") String controlScope,
@Query("experimentScope") String experimentScope,
@Query("startTimeIso") String startTimeIso,
@Query("endTimeIso") String endTimeIso,
@Query("step") String step,
@Body Map<String, String> extendedScopeParams,
@Query("scoreThresholdPass") String scoreThresholdPass,
@Query("scoreThresholdMarginal") String scoreThresholdMarginal)
@POST("/canary/{canaryConfigId}")
Map create(@Path("canaryConfigId") String canaryConfigId,
@Query("metricsAccountName") String metricsAccountName,
@Query("configurationAccountName") String configurationAccountName,
@Query("storageAccountName") String storageAccountName,
@Body Map<String, String> canaryExecutionRequest)

@GET("/pipelines/{executionId}")
Pipeline getPipelineExecution(@Path("executionId") String executionId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,31 @@ class RunCanaryTask implements Task {
String step = (String)context.get("step")
Map<String, String> extendedScopeParams = (Map<String, String>)context.get("extendedScopeParams")
Map<String, String> scoreThresholds = (Map<String, String>)context.get("scoreThresholds")
Response response = kayentaService.create(metricsAccountName,
storageAccountName,
canaryConfigId,
controlScope,
experimentScope,
startTimeIso,
endTimeIso,
step,
extendedScopeParams,
scoreThresholds?.pass,
scoreThresholds?.marginal)
String canaryPipelineExecutionId = new String(((TypedByteArray)response.getBody()).getBytes())
Map<String, String> canaryExecutionRequest = [
controlScope: [
scope: controlScope,
start: startTimeIso,
end: endTimeIso,
step: step,
extendedScopeParams: extendedScopeParams
],
experimentScope: [
scope: experimentScope,
start: startTimeIso,
end: endTimeIso,
step: step,
extendedScopeParams: extendedScopeParams
],
thresholds: [
pass: scoreThresholds?.pass,
marginal: scoreThresholds?.marginal
]
]
String canaryPipelineExecutionId = kayentaService.create(canaryConfigId,
metricsAccountName,
storageAccountName /* configurationAccountName */, // TODO(duftler): Propagate configurationAccountName properly.
storageAccountName,
canaryExecutionRequest).canaryExecutionId

return new TaskResult(ExecutionStatus.SUCCEEDED, [canaryPipelineExecutionId: canaryPipelineExecutionId])
}
Expand Down

0 comments on commit 4decfc8

Please sign in to comment.