diff options
author | Ola Aunrønning <olaa@verizonmedia.com> | 2019-10-07 13:16:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-07 13:16:50 +0200 |
commit | 6fe971b78d66159bfec64b2981135709625043df (patch) | |
tree | e5f9fb2f3cd4b171488d3233c328f48ef51c5282 /controller-api | |
parent | 385ff3f0d79e76eba8c6cf688bc730fb14b0dd38 (diff) | |
parent | cfb1ae9d80940c1867b4f4a096d51045ea5ec397 (diff) |
Merge pull request #10876 from vespa-engine/olaa/metering-by-zone
Add zone dimension to metering data
Diffstat (limited to 'controller-api')
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java index a378bcb63bd..5ee6df9f034 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java @@ -2,6 +2,7 @@ package com.yahoo.vespa.hosted.controller.api.integration.resource; import com.yahoo.config.provision.ApplicationId; +import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node; import java.time.Instant; @@ -17,14 +18,16 @@ public class ResourceSnapshot { private final ApplicationId applicationId; private final ResourceAllocation resourceAllocation; private final Instant timestamp; + private final ZoneId zoneId; - public ResourceSnapshot(ApplicationId applicationId, double cpuCores, double memoryGb, double diskGb, Instant timestamp) { + public ResourceSnapshot(ApplicationId applicationId, double cpuCores, double memoryGb, double diskGb, Instant timestamp, ZoneId zoneId) { this.applicationId = applicationId; this.resourceAllocation = new ResourceAllocation(cpuCores, memoryGb, diskGb); this.timestamp = timestamp; + this.zoneId = zoneId; } - public static ResourceSnapshot from(List<Node> nodes, Instant timestamp) { + public static ResourceSnapshot from(List<Node> nodes, Instant timestamp, ZoneId zoneId) { Set<ApplicationId> applicationIds = nodes.stream() .filter(node -> node.owner().isPresent()) .map(node -> node.owner().get()) @@ -37,7 +40,8 @@ public class ResourceSnapshot { nodes.stream().mapToDouble(Node::vcpu).sum(), nodes.stream().mapToDouble(Node::memoryGb).sum(), nodes.stream().mapToDouble(Node::diskGb).sum(), - timestamp + timestamp, + zoneId ); } @@ -61,4 +65,8 @@ public class ResourceSnapshot { return timestamp; } + public ZoneId getZoneId() { + return zoneId; + } + } |