Skip to content

Commit

Permalink
fix atlas scopes to be 'application, cluster, or query' (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Graff committed Sep 30, 2017
1 parent b36e040 commit e76f5c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ public class AtlasCanaryScope extends CanaryScope {

public String cq() {
if (type == null) {
throw new IllegalArgumentException("Atlas canary scope requires 'type' to be application, cluster or node.");
throw new IllegalArgumentException("Atlas canary scope requires 'type' to be application, cluster or query.");
}

switch (type) {
case "application":
return ":list,(,nf.app," + scope + ",:eq,:cq,),:each";
case "cluster":
case "node":
return ":list,(,nf." + type + "," + scope + ",:eq,:cq,),:each";
return ":list,(,nf.cluster," + scope + ",:eq,:cq,),:each";
case "query":
return ":list,(," + scope + ",:cq,),:each";
default:
throw new IllegalArgumentException("Scope type '" + type + "' is unknown: scope=" + scope);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public String initiateCanary(@RequestParam(required = false) final String metric
@ApiParam(defaultValue = "2017-07-02T15:27:00Z") @RequestParam String endTimeIso,
// TODO(duftler): Normalize this somehow. Stackdriver expects a number in seconds and Atlas expects a duration like PT10S.
@ApiParam(value = "Stackdriver expects a number in seconds and Atlas expects a duration like PT10S.", defaultValue = "3600") @RequestParam String step,
@ApiParam(value = "Atlas requires \"type\" to be set to application, cluster or node.") @RequestBody(required = false) Map<String, String> extendedScopeParams,
@ApiParam(value = "Atlas requires \"type\" to be set to application, cluster or query.") @RequestBody(required = false) Map<String, String> extendedScopeParams,
@RequestParam(required = false) String scoreThresholdPass,
@RequestParam(required = false) String scoreThresholdMarginal) {
String resolvedMetricsAccountName = CredentialsHelper.resolveAccountByNameOrType(metricsAccountName,
Expand Down

0 comments on commit e76f5c8

Please sign in to comment.