use of com.netflix.titus.api.appscale.model.MetricDimension in project titus-control-plane by Netflix.
the class CloudWatchClient method buildMetricDimensions.
@VisibleForTesting
static List<Dimension> buildMetricDimensions(AlarmConfiguration alarmConfiguration, String autoScalingGroup) {
List<Dimension> metricDimensions = new ArrayList<>(1);
if (alarmConfiguration.getDimensions() != null && !alarmConfiguration.getDimensions().isEmpty()) {
for (MetricDimension customMetricDimension : alarmConfiguration.getDimensions()) {
Dimension dimension = new Dimension();
dimension.setName(customMetricDimension.getName());
dimension.setValue(customMetricDimension.getValue());
metricDimensions.add(dimension);
}
} else {
Dimension dimension = new Dimension();
dimension.setName(AUTO_SCALING_GROUP_NAME);
dimension.setValue(autoScalingGroup);
metricDimensions.add(dimension);
}
return metricDimensions;
}
use of com.netflix.titus.api.appscale.model.MetricDimension in project titus-control-plane by Netflix.
the class CloudWatchClientTest method buildCustomMetricDimensions.
@Test
public void buildCustomMetricDimensions() {
MetricDimension md1 = MetricDimension.newBuilder().withName("foo").withValue("bar").build();
MetricDimension md2 = MetricDimension.newBuilder().withName("service-tier").withValue("1").build();
List<MetricDimension> customMetricDimensions = Arrays.asList(md1, md2);
AlarmConfiguration alarmConfiguration = getAlarmConfigBuilder().withDimensions(customMetricDimensions).build();
List<Dimension> dimensions = CloudWatchClient.buildMetricDimensions(alarmConfiguration, "foo-bar");
assertThat(dimensions).isNotNull();
assertThat(dimensions.size()).isEqualTo(2);
assertThat(dimensions.get(0).getName()).isEqualTo("foo");
assertThat(dimensions.get(0).getValue()).isEqualTo("bar");
assertThat(dimensions.get(1).getName()).isEqualTo("service-tier");
assertThat(dimensions.get(1).getValue()).isEqualTo("1");
}
Aggregations