aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main
diff options
context:
space:
mode:
authorOla Aunrønning <olaa@verizonmedia.com>2019-10-18 16:38:28 +0200
committerOla Aunrønning <olaa@verizonmedia.com>2019-10-18 16:40:52 +0200
commita2ac8ec8bae6fb2889e36fcbedbdf712bf68df67 (patch)
tree3c59dd883c70c372ea0168ed0404eab229803540 /controller-server/src/main
parent7554e7b7dd6f0eade988baa021ffd7e2184907f1 (diff)
Use BigDecimal
Diffstat (limited to 'controller-server/src/main')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
index 26d0520164e..e13374352c6 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
@@ -94,6 +94,7 @@ import javax.ws.rs.NotAuthorizedException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.math.RoundingMode;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.DigestInputStream;
@@ -404,13 +405,13 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
costObject.setString("applicationId", costInfo.getApplicationId().serializedForm());
costObject.setString("zoneId", costInfo.getZoneId().value());
Cursor cpu = costObject.setObject("cpu");
- cpu.setDouble("usage", costInfo.getCpuHours());
+ cpu.setDouble("usage", costInfo.getCpuHours().setScale(1, RoundingMode.HALF_UP).doubleValue());
cpu.setLong("charge", costInfo.getCpuCost());
Cursor memory = costObject.setObject("memory");
- memory.setDouble("usage", costInfo.getMemoryHours());
+ memory.setDouble("usage", costInfo.getMemoryHours().setScale(1, RoundingMode.HALF_UP).doubleValue());
memory.setLong("charge", costInfo.getMemoryCost());
Cursor disk = costObject.setObject("disk");
- disk.setDouble("usage", costInfo.getDiskHours());
+ disk.setDouble("usage", costInfo.getDiskHours().setScale(1, RoundingMode.HALF_UP).doubleValue());
disk.setLong("charge", costInfo.getDiskCost());
});