Skip to content

Commit

Permalink
feat(canary): Exposes API initiating canary given a config. (#918)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtk54 authored Oct 9, 2019
1 parent fae483e commit 83aa1f5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .idea/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ class V2CanaryController {
configurationAccountName)
}

@ApiOperation(value = 'Start a canary execution with the supplied canary config')
@RequestMapping(value = '/canary', method = RequestMethod.POST)
Map initiateCanaryWithConfig(@RequestBody Map adhocExecutionRequest,
@RequestParam(value = 'application', required = false) String application,
@RequestParam(value = 'parentPipelineExecutionId', required = false) String parentPipelineExecutionId,
@RequestParam(value = 'metricsAccountName', required = false) String metricsAccountName,
@RequestParam(value = 'storageAccountName', required = false) String storageAccountName) {
v2CanaryService.initiateCanaryWithConfig(adhocExecutionRequest,
application,
parentPipelineExecutionId,
metricsAccountName,
storageAccountName)
}

@ApiOperation(value = 'Retrieve a canary result')
@RequestMapping(value = '/canary/{canaryConfigId}/{canaryExecutionId}', method = RequestMethod.GET)
Map getCanaryResult(@PathVariable String canaryConfigId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ class V2CanaryService {
}).execute() as List
}

Map initiateCanaryWithConfig(Map adhocExecutionRequest,
String application,
String parentPipelineExecutionId,
String metricsAccountName,
String storageAccountName) {
return HystrixFactory.newMapCommand(HYSTRIX_GROUP, "initiateCanaryWithConfig", {
try {
return kayentaService.initiateCanaryWithConfig(adhocExecutionRequest,
application,
parentPipelineExecutionId,
metricsAccountName,
storageAccountName)
} catch (RetrofitError error) {
throw classifyError(error)
}
}).execute() as Map
}

Map initiateCanary(String canaryConfigId,
Map executionRequest,
String application,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ interface KayentaService {
@GET("/judges")
List listJudges()

@POST("/canary")
Map initiateCanaryWithConfig(@Body Map adhocExecutionRequest,
@Query("application") String application,
@Query("parentPipelineExecutionId") String parentPipelineExecutionId,
@Query("metricsAccountName") String metricsAccountName,
@Query("storageAccountName") String storageAccountName)

@POST("/canary/{canaryConfigId}")
Map initiateCanary(@Path("canaryConfigId") String canaryConfigId,
@Body Map executionRequest,
Expand Down

0 comments on commit 83aa1f5

Please sign in to comment.