@Test public void testBuildQuery_NoAggregateProvided() { CanaryScope canaryScope = createScope(SCOPE); CanaryMetricConfig canaryMetricSetQueryConfig = queryConfig(""); String query = wavefrontMetricsService.buildQuery("", null, canaryMetricSetQueryConfig, canaryScope); assertThat(query, is("ts(" + METRIC_NAME + ", " + SCOPE + ")")); }
@Override public String buildQuery( String metricsAccountName, CanaryConfig canaryConfig, CanaryMetricConfig canaryMetricConfig, CanaryScope canaryScope) { WavefrontCanaryMetricSetQueryConfig queryConfig = (WavefrontCanaryMetricSetQueryConfig) canaryMetricConfig.getQuery(); String query = queryConfig.getMetricName(); if (canaryScope.getScope() != null && !canaryScope.getScope().equals("")) { query = query + ", " + canaryScope.getScope(); } query = "ts(" + query + ")"; if (queryConfig.getAggregate() != null && !queryConfig.getAggregate().equals("")) { query = queryConfig.getAggregate() + "(" + query + ")"; } return query; }
WavefrontMetricsService implements MetricsService { @Override public String buildQuery( String metricsAccountName, CanaryConfig canaryConfig, CanaryMetricConfig canaryMetricConfig, CanaryScope canaryScope) { WavefrontCanaryMetricSetQueryConfig queryConfig = (WavefrontCanaryMetricSetQueryConfig) canaryMetricConfig.getQuery(); String query = queryConfig.getMetricName(); if (canaryScope.getScope() != null && !canaryScope.getScope().equals("")) { query = query + ", " + canaryScope.getScope(); } query = "ts(" + query + ")"; if (queryConfig.getAggregate() != null && !queryConfig.getAggregate().equals("")) { query = queryConfig.getAggregate() + "(" + query + ")"; } return query; } }
WavefrontMetricsService implements MetricsService { @Override public String buildQuery( String metricsAccountName, CanaryConfig canaryConfig, CanaryMetricConfig canaryMetricConfig, CanaryScope canaryScope) { WavefrontCanaryMetricSetQueryConfig queryConfig = (WavefrontCanaryMetricSetQueryConfig) canaryMetricConfig.getQuery(); String query = queryConfig.getMetricName(); if (canaryScope.getScope() != null && !canaryScope.getScope().equals("")) { query = query + ", " + canaryScope.getScope(); } query = "ts(" + query + ")"; if (queryConfig.getAggregate() != null && !queryConfig.getAggregate().equals("")) { query = queryConfig.getAggregate() + "(" + query + ")"; } return query; }  }
WavefrontMetricsService implements MetricsService { @Override public String buildQuery( String metricsAccountName, CanaryConfig canaryConfig, CanaryMetricConfig canaryMetricConfig, CanaryScope canaryScope) { WavefrontCanaryMetricSetQueryConfig queryConfig = (WavefrontCanaryMetricSetQueryConfig) canaryMetricConfig.getQuery(); String query = queryConfig.getMetricName(); if (canaryScope.getScope() != null && !canaryScope.getScope().equals("")) { query = query + ", " + canaryScope.getScope(); } query = "ts(" + query + ")"; if (queryConfig.getAggregate() != null && !queryConfig.getAggregate().equals("")) { query = queryConfig.getAggregate() + "(" + query + ")"; } return query; }  @Override String getType(); @Override boolean servicesAccount(String accountName); @Override String buildQuery(
      String metricsAccountName,
      CanaryConfig canaryConfig,
      CanaryMetricConfig canaryMetricConfig,
      CanaryScope canaryScope); @Override List<MetricSet> queryMetrics(
      String accountName,
      CanaryConfig canaryConfig,
      CanaryMetricConfig canaryMetricConfig,
      CanaryScope canaryScope); }
WavefrontMetricsService implements MetricsService { @Override public String buildQuery( String metricsAccountName, CanaryConfig canaryConfig, CanaryMetricConfig canaryMetricConfig, CanaryScope canaryScope) { WavefrontCanaryMetricSetQueryConfig queryConfig = (WavefrontCanaryMetricSetQueryConfig) canaryMetricConfig.getQuery(); String query = queryConfig.getMetricName(); if (canaryScope.getScope() != null && !canaryScope.getScope().equals("")) { query = query + ", " + canaryScope.getScope(); } query = "ts(" + query + ")"; if (queryConfig.getAggregate() != null && !queryConfig.getAggregate().equals("")) { query = queryConfig.getAggregate() + "(" + query + ")"; } return query; }  @Override String getType(); @Override boolean servicesAccount(String accountName); @Override String buildQuery(
      String metricsAccountName,
      CanaryConfig canaryConfig,
      CanaryMetricConfig canaryMetricConfig,
      CanaryScope canaryScope); @Override List<MetricSet> queryMetrics(
      String accountName,
      CanaryConfig canaryConfig,
      CanaryMetricConfig canaryMetricConfig,
      CanaryScope canaryScope);  }