Skip to content

Commit

Permalink
feat(stackdriver): Expose name of metrics store type for use in ui. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Duftler committed Mar 16, 2018
1 parent 9d07872 commit 3ed16f1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
// TODO(duftler): Figure out how to move this into the kayenta-stackdriver module? Doing so as-is would introduce a circular dependency.
public class StackdriverCanaryMetricSetQueryConfig implements CanaryMetricSetQueryConfig {

public static final String SERVICE_TYPE = "stackdriver";

@NotNull
@Getter
private String metricType;
Expand All @@ -45,6 +47,6 @@ public class StackdriverCanaryMetricSetQueryConfig implements CanaryMetricSetQue

@Override
public String getServiceType() {
return "stackdriver";
return SERVICE_TYPE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.api.services.monitoring.v3.Monitoring;
import com.google.api.services.storage.Storage;
import com.netflix.kayenta.canary.providers.StackdriverCanaryMetricSetQueryConfig;
import com.netflix.kayenta.security.AccountCredentials;
import lombok.Builder;
import lombok.Data;
Expand Down Expand Up @@ -53,6 +54,10 @@ public String getType() {
return "google";
}

public String getMetricsStoreType() {
return supportedTypes.contains(Type.METRICS_STORE) ? StackdriverCanaryMetricSetQueryConfig.SERVICE_TYPE : null;
}

@JsonIgnore
private Monitoring monitoring;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.netflix.kayenta.canary.CanaryScope;
import com.netflix.kayenta.canary.CanaryScopeFactory;
import com.netflix.kayenta.canary.providers.StackdriverCanaryMetricSetQueryConfig;
import org.springframework.stereotype.Component;

import java.util.Map;
Expand All @@ -27,7 +28,7 @@ public class StackdriverCanaryScopeFactory implements CanaryScopeFactory {

@Override
public boolean handles(String serviceType) {
return "stackdriver".equals(serviceType);
return StackdriverCanaryMetricSetQueryConfig.SERVICE_TYPE.equals(serviceType);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class StackdriverMetricsService implements MetricsService {

@Override
public String getType() {
return "stackdriver";
return StackdriverCanaryMetricSetQueryConfig.SERVICE_TYPE;
}

@Override
Expand Down

0 comments on commit 3ed16f1

Please sign in to comment.