diff options
author | Jon Bratseth <bratseth@oath.com> | 2021-02-19 17:14:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-19 17:14:44 +0100 |
commit | 5254e4a91f40886364c2929e81f55e1e1200554c (patch) | |
tree | de0355eb944a606e0f4398252285b2751209e4d3 | |
parent | 889dbb197126aa615a7fb9659cb1e938fdca76ed (diff) | |
parent | cfa70b45dc89d009a925072c9238835e89f57630 (diff) |
Merge pull request #16593 from vespa-engine/freva/always-show-cost
Show cost in public as well
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java | 9 |
1 files changed, 5 insertions, 4 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 1d3ccdb6fa7..d435ad2da77 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 @@ -65,6 +65,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.noderepository.RestartF import com.yahoo.vespa.hosted.controller.api.integration.resource.MeteringData; import com.yahoo.vespa.hosted.controller.api.integration.resource.ResourceAllocation; import com.yahoo.vespa.hosted.controller.api.integration.resource.ResourceSnapshot; +import com.yahoo.vespa.hosted.controller.api.integration.secrets.TenantSecretStore; import com.yahoo.vespa.hosted.controller.api.role.Role; import com.yahoo.vespa.hosted.controller.api.role.RoleDefinition; import com.yahoo.vespa.hosted.controller.api.role.SecurityContext; @@ -98,7 +99,6 @@ import com.yahoo.vespa.hosted.controller.tenant.Tenant; import com.yahoo.vespa.hosted.controller.tenant.TenantInfo; import com.yahoo.vespa.hosted.controller.tenant.TenantInfoAddress; import com.yahoo.vespa.hosted.controller.tenant.TenantInfoBillingContact; -import com.yahoo.vespa.hosted.controller.api.integration.secrets.TenantSecretStore; import com.yahoo.vespa.hosted.controller.versions.VersionStatus; import com.yahoo.vespa.hosted.controller.versions.VespaVersion; import com.yahoo.vespa.serviceview.bindings.ApplicationView; @@ -118,7 +118,6 @@ import java.security.PublicKey; import java.time.DayOfWeek; import java.time.Duration; import java.time.Instant; -import java.util.ArrayList; import java.util.Arrays; import java.util.Base64; import java.util.Comparator; @@ -2002,8 +2001,10 @@ public class ApplicationApiHandler extends LoggingRequestHandler { object.setLong("nodes", resources.nodes()); object.setLong("groups", resources.groups()); toSlime(resources.nodeResources(), object.setObject("nodeResources")); - if ( ! controller.zoneRegistry().system().isPublic()) - object.setDouble("cost", Math.round(resources.nodes() * resources.nodeResources().cost() * 100.0 / 3.0) / 100.0); + + // Divide cost by 3 in non-public zones to show approx. AWS equivalent cost + double costDivisor = controller.zoneRegistry().system().isPublic() ? 1.0 : 3.0; + object.setDouble("cost", Math.round(resources.nodes() * resources.nodeResources().cost() * 100.0 / costDivisor) / 100.0); } private void utilizationToSlime(Cluster.Utilization utilization, Cursor utilizationObject) { |