if (metrics.contains(throughputType)) {
// Throughput metric
final Dimension throughputDimension = new Dimension()
.withName(Dimensions.MetricType.name())
.withValue(throughputType.name());
final MetricDatum throughputDatum = new MetricDatum()
.withMetricName(throughputType.getServiceName())
.withDimensions(throughputDimension)
.withUnit(StandardUnit.BytesSecond)
.withValue(bytesPerSec);
safeAddMetricsToQueue(throughputDatum);
}
if (metrics.contains(byteCountType)) {
// Byte count metric
final Dimension byteCountDimension = new Dimension()
.withName(Dimensions.MetricType.name())
.withValue(byteCountType.name());
final MetricDatum byteCountDatum = new MetricDatum()
.withMetricName(byteCountType.getServiceName())
.withDimensions(byteCountDimension)
.withUnit(StandardUnit.Bytes)
.withValue(byteCount);
safeAddMetricsToQueue(byteCountDatum);