bug修复
parent
4f38e65339
commit
d0fa323e2b
|
@ -25,6 +25,7 @@ import org.apache.http.impl.client.HttpClients;
|
|||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
@ -113,20 +114,22 @@ public class AlistarController {
|
|||
}
|
||||
item.put("instanceUuid", DigestUtils.md5Hex("ALISTAR-" + instance.getInstanceId()));
|
||||
List<AlistarInstanceMetricValue> values = this.getAlistarResourceInstanceMetricValue(instance);
|
||||
for (AlistarInstanceMetricValue value : values) {
|
||||
if (value.getKey().startsWith("os.memory.") || value.getKey().startsWith("memory.")) {
|
||||
BigDecimal valueGB = new BigDecimal(value.getValue()).divide(BigDecimal.valueOf(1024L * 1024L * 1024L), 3, RoundingMode.HALF_UP);
|
||||
item.put(value.getKey(), valueGB.toPlainString());
|
||||
} else if (value.getKey().startsWith("capacity.")) {
|
||||
BigDecimal valueGB = new BigDecimal(value.getValue()).divide(BigDecimal.valueOf(1024L * 1024L * 1024L * 1024L), 3, RoundingMode.HALF_UP);
|
||||
item.put(value.getKey(), valueGB.toPlainString());
|
||||
} else if (value.getKey().startsWith("net.interface.") ||
|
||||
value.getKey().startsWith("os.service.") ||
|
||||
value.getKey().startsWith("os.processor.") ||
|
||||
value.getKey().startsWith("os.process.")) {
|
||||
// do nothing
|
||||
} else {
|
||||
item.put(value.getKey(), value.getValue());
|
||||
if (!CollectionUtils.isEmpty(values)) {
|
||||
for (AlistarInstanceMetricValue value : values) {
|
||||
if (value.getKey().startsWith("os.memory.") || value.getKey().startsWith("memory.")) {
|
||||
BigDecimal valueGB = new BigDecimal(value.getValue()).divide(BigDecimal.valueOf(1024L * 1024L * 1024L), 3, RoundingMode.HALF_UP);
|
||||
item.put(value.getKey(), valueGB.toPlainString());
|
||||
} else if (value.getKey().startsWith("capacity.")) {
|
||||
BigDecimal valueGB = new BigDecimal(value.getValue()).divide(BigDecimal.valueOf(1024L * 1024L * 1024L * 1024L), 3, RoundingMode.HALF_UP);
|
||||
item.put(value.getKey(), valueGB.toPlainString());
|
||||
} else if (value.getKey().startsWith("net.interface.") ||
|
||||
value.getKey().startsWith("os.service.") ||
|
||||
value.getKey().startsWith("os.processor.") ||
|
||||
value.getKey().startsWith("os.process.")) {
|
||||
// do nothing
|
||||
} else {
|
||||
item.put(value.getKey(), value.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
list.add(item);
|
||||
|
|
Loading…
Reference in New Issue