diff options
author | Ola Aunrønning <olaa@verizonmedia.com> | 2022-05-11 19:39:13 +0200 |
---|---|---|
committer | Ola Aunrønning <olaa@verizonmedia.com> | 2022-06-13 13:27:39 +0200 |
commit | 5c5760da245d018ba465202e64446a795be63f6d (patch) | |
tree | a5dc2c8375c96c6889ea73ef7e837f1cb7a078d4 /controller-api | |
parent | 9ed4500b380ce77c1dc9f303006c02ba8096ee42 (diff) |
Monitor metering freshness
Diffstat (limited to 'controller-api')
2 files changed, 17 insertions, 2 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceDatabaseClient.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceDatabaseClient.java index 8ae12c0e7ac..8d4a6515f2b 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceDatabaseClient.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceDatabaseClient.java @@ -1,14 +1,16 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration.resource; -import com.yahoo.config.provision.ApplicationName; +import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.TenantName; +import com.yahoo.config.provision.zone.ZoneId; import java.time.LocalDate; import java.time.YearMonth; import java.time.temporal.ChronoUnit; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Set; /** @@ -28,6 +30,8 @@ public interface ResourceDatabaseClient { Set<TenantName> getTenants(); + Map<ApplicationId, Set<ZoneId>> getLastSnapshots(); + default List<ResourceUsage> getResourceSnapshotsForMonth(TenantName tenantName, YearMonth month) { return getResourceSnapshotsForPeriod(tenantName, getMonthStartTimeStamp(month), getMonthEndTimeStamp(month)); } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceDatabaseClientMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceDatabaseClientMock.java index c680990e240..69378d97787 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceDatabaseClientMock.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceDatabaseClientMock.java @@ -1,8 +1,10 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration.resource; +import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ApplicationName; import com.yahoo.config.provision.TenantName; +import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.vespa.hosted.controller.api.integration.billing.Plan; import com.yahoo.vespa.hosted.controller.api.integration.billing.PlanRegistry; @@ -11,7 +13,6 @@ import java.time.Duration; import java.time.Instant; import java.time.LocalDate; import java.time.YearMonth; -import java.time.ZoneId; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,6 +34,7 @@ public class ResourceDatabaseClientMock implements ResourceDatabaseClient { PlanRegistry planRegistry; Map<TenantName, Plan> planMap = new HashMap<>(); List<ResourceSnapshot> resourceSnapshots = new ArrayList<>(); + Map<ApplicationId, Set<ZoneId>> lastSnapshots = new HashMap<>(); private boolean hasRefreshedMaterializedView = false; public ResourceDatabaseClientMock(PlanRegistry planRegistry) { @@ -126,6 +128,11 @@ public class ResourceDatabaseClientMock implements ResourceDatabaseClient { hasRefreshedMaterializedView = true; } + @Override + public Map<ApplicationId, Set<ZoneId>> getLastSnapshots() { + return lastSnapshots; + } + public void setPlan(TenantName tenant, Plan plan) { planMap.put(tenant, plan); } @@ -133,4 +140,8 @@ public class ResourceDatabaseClientMock implements ResourceDatabaseClient { public boolean hasRefreshedMaterializedView() { return hasRefreshedMaterializedView; } + + public void setLastSnapshots(Map<ApplicationId, Set<ZoneId>> lastSnapshots) { + this.lastSnapshots = lastSnapshots; + } } |