PutMetricDataRequest req = newPutMetricDataRequest(data, ns);
list.add(req);
final boolean perHost = AwsSdkMetrics.isPerHostMetricEnabled();
String perHostNameSpace = null;
String hostName = null;
Dimension hostDim = null;
final boolean singleNamespace = AwsSdkMetrics.isSingleMetricNamespace();
if (perHost) {
hostName = AwsSdkMetrics.getHostMetricName();
hostName = hostName == null ? "" : hostName.trim();
if (hostName.length() == 0)
hostName = AwsHostNameUtils.localHostName();
hostDim = dimension(Dimensions.Host, hostName);
if (singleNamespace) {
req = newPutMetricDataRequest(data, ns, hostDim);
} else {
perHostNameSpace = ns + NAMESPACE_DELIMITER + hostName;
req = newPutMetricDataRequest(data, perHostNameSpace);
}
list.add(req);
}
String jvmMetricName = AwsSdkMetrics.getJvmMetricName();
if (jvmMetricName != null) {
jvmMetricName = jvmMetricName.trim();
if (jvmMetricName.length() > 0) {
if (singleNamespace) {
Dimension jvmDim = dimension(Dimensions.JVM, jvmMetricName);
if (perHost) {
// If OS metrics are already included at the per host level,
// there is little reason, if any, to include them at the
// JVM level. Hence the filtering.
req = newPutMetricDataRequest(