summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgjoranv <gjoranv@gmail.com>2023-03-06 15:52:38 +0100
committerGitHub <noreply@github.com>2023-03-06 15:52:38 +0100
commite7bd82c4ae1e758e0eaeca13c9623ba811ef3926 (patch)
treeb97673d20be9288fe50163d724d495afd35f52dc
parent3231d8567d90a8fd8229a69d2d7ac57173655a29 (diff)
parent8cb9fcf7dca10cc430ccfec59995f980b52c9ce2 (diff)
Merge pull request #26314 from vespa-engine/bratseth/last
Bratseth/last
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/AutoscalingMetrics.java4
-rw-r--r--container-core/src/main/java/com/yahoo/container/handler/VipStatus.java3
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsResponse.java5
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsV2MetricsFetcherTest.java220
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeMetricsDbMaintainerTest.java96
5 files changed, 170 insertions, 158 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/AutoscalingMetrics.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/AutoscalingMetrics.java
index 30810d428c1..fb57774e0cf 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/AutoscalingMetrics.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/AutoscalingMetrics.java
@@ -32,9 +32,9 @@ public class AutoscalingMetrics {
metrics.add(HostedNodeAdminMetrics.DISK_UTIL.baseName()); // node level -default
metrics.add(SearchNodeMetrics.CONTENT_PROTON_RESOURCE_USAGE_DISK.average()); // better for content as it is the basis for blocking
- metrics.add(ContainerMetrics.APPLICATION_GENERATION.baseName());
+ metrics.add(ContainerMetrics.APPLICATION_GENERATION.last());
- metrics.add(ContainerMetrics.IN_SERVICE.baseName());
+ metrics.add(ContainerMetrics.IN_SERVICE.last());
// Query rate
metrics.add(ContainerMetrics.QUERIES.rate()); // container
diff --git a/container-core/src/main/java/com/yahoo/container/handler/VipStatus.java b/container-core/src/main/java/com/yahoo/container/handler/VipStatus.java
index 2238abc584e..b9a6d8d9462 100644
--- a/container-core/src/main/java/com/yahoo/container/handler/VipStatus.java
+++ b/container-core/src/main/java/com/yahoo/container/handler/VipStatus.java
@@ -6,6 +6,7 @@ import com.yahoo.container.QrSearchersConfig;
import com.yahoo.container.core.VipStatusConfig;
import com.yahoo.container.jdisc.state.StateMonitor;
import com.yahoo.jdisc.Metric;
+import com.yahoo.metrics.ContainerMetrics;
import java.util.Map;
import java.util.stream.Collectors;
@@ -119,7 +120,7 @@ public class VipStatus {
else if (healthState.status() == StateMonitor.Status.up)
healthState.status(StateMonitor.Status.down);
- metric.set("in_service", currentlyInRotation ? 1 : 0, metric.createContext(Map.of()));
+ metric.set(ContainerMetrics.IN_SERVICE.baseName(), currentlyInRotation ? 1 : 0, metric.createContext(Map.of()));
}
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsResponse.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsResponse.java
index c6f9c6fdd36..84988be99ec 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsResponse.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsResponse.java
@@ -21,6 +21,7 @@ import java.util.Map;
import java.util.Optional;
import static com.yahoo.metrics.ContainerMetrics.APPLICATION_GENERATION;
+import static com.yahoo.metrics.ContainerMetrics.IN_SERVICE;
/**
* A response containing metrics for a collection of nodes.
@@ -165,7 +166,7 @@ public class MetricsResponse {
@Override
public List<String> metricResponseNames() {
- return List.of(APPLICATION_GENERATION.baseName() /*, "content.proton.config.generation" */);
+ return List.of(APPLICATION_GENERATION.last() /*, "content.proton.config.generation" */);
}
@Override
@@ -177,7 +178,7 @@ public class MetricsResponse {
inService {
@Override
- public List<String> metricResponseNames() { return List.of("in_service"); }
+ public List<String> metricResponseNames() { return List.of(IN_SERVICE.last()); }
@Override
double computeFinal(ListMap<String, Double> values) {
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsV2MetricsFetcherTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsV2MetricsFetcherTest.java
index e83880404f4..24697d02681 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsV2MetricsFetcherTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsV2MetricsFetcherTest.java
@@ -76,6 +76,7 @@ public class MetricsV2MetricsFetcherTest {
assertEquals(0.15, values.get(0).getSecond().load().memory(), delta);
assertEquals(0.20, values.get(0).getSecond().load().disk(), delta);
assertEquals(3, values.get(0).getSecond().generation(), delta);
+ assertFalse(values.get(0).getSecond().inService());
assertTrue(values.get(0).getSecond().stable());
}
@@ -108,114 +109,119 @@ public class MetricsV2MetricsFetcherTest {
}
final String cannedResponseForApplication1 =
- "{\n" +
- " \"nodes\": [\n" +
- " {\n" +
- " \"hostname\": \"host-1.yahoo.com\",\n" +
- " \"role\": \"role0\",\n" +
- " \"node\": {\n" +
- " \"timestamp\": 1234,\n" +
- " \"metrics\": [\n" +
- " {\n" +
- " \"values\": {\n" +
- " \"cpu.util\": 16.2,\n" +
- " \"mem.util\": 23.1,\n" +
- " \"disk.util\": 82\n" +
- " },\n" +
- " \"dimensions\": {\n" +
- " \"state\": \"active\"\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " {\n" +
- " \"hostname\": \"host-2.yahoo.com\",\n" +
- " \"role\": \"role1\",\n" +
- " \"node\": {\n" +
- " \"timestamp\": 1200,\n" +
- " \"metrics\": [\n" +
- " {\n" +
- " \"values\": {\n" +
- " \"mem.util\": 30,\n" +
- " \"disk.util\": 40\n" +
- " },\n" +
- " \"dimensions\": {\n" +
- " \"state\": \"active\"\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"services\": [\n" +
- " {\n" +
- " \"name\": \"searchnode\",\n" +
- " \"timestamp\": 1234,\n" +
- " \"status\": {\n" +
- " \"code\": \"up\"\n" +
- " },\n" +
- " \"metrics\": [\n" +
- " {\n" +
- " \"values\": {\n" +
- " \"content.proton.documentdb.matching.queries.rate\": 20.5\n" +
- " },\n" +
- " \"dimensions\": {\n" +
- " \"documentType\": \"music\"\n" +
- " }\n" +
- " },\n" +
- " {\n" +
- " \"values\": {\n" +
- " \"content.proton.resource_usage.memory.average\": 0.35,\n" +
- " \"content.proton.resource_usage.disk.average\": 0.45\n" +
- " },\n" +
- " \"dimensions\": {\n" +
- " }\n" +
- " },\n" +
- " {\n" +
- " \"values\": {\n" +
- " \"content.proton.documentdb.matching.queries.rate\": 13.5\n" +
- " },\n" +
- " \"dimensions\": {\n" +
- " \"documentType\": \"books\"\n" +
- " }\n" +
- " },\n" +
- " {\n" +
- " \"values\": {\n" +
- " \"queries.rate\": 11.0\n" +
- " },\n" +
- " \"dimensions\": {\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- "}\n";
+ """
+ {
+ "nodes": [
+ {
+ "hostname": "host-1.yahoo.com",
+ "role": "role0",
+ "node": {
+ "timestamp": 1234,
+ "metrics": [
+ {
+ "values": {
+ "cpu.util": 16.2,
+ "mem.util": 23.1,
+ "disk.util": 82
+ },
+ "dimensions": {
+ "state": "active"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "hostname": "host-2.yahoo.com",
+ "role": "role1",
+ "node": {
+ "timestamp": 1200,
+ "metrics": [
+ {
+ "values": {
+ "mem.util": 30,
+ "disk.util": 40
+ },
+ "dimensions": {
+ "state": "active"
+ }
+ }
+ ]
+ },
+ "services": [
+ {
+ "name": "searchnode",
+ "timestamp": 1234,
+ "status": {
+ "code": "up"
+ },
+ "metrics": [
+ {
+ "values": {
+ "content.proton.documentdb.matching.queries.rate": 20.5
+ },
+ "dimensions": {
+ "documentType": "music"
+ }
+ },
+ {
+ "values": {
+ "content.proton.resource_usage.memory.average": 0.35,
+ "content.proton.resource_usage.disk.average": 0.45
+ },
+ "dimensions": {
+ }
+ },
+ {
+ "values": {
+ "content.proton.documentdb.matching.queries.rate": 13.5
+ },
+ "dimensions": {
+ "documentType": "books"
+ }
+ },
+ {
+ "values": {
+ "queries.rate": 11.0
+ },
+ "dimensions": {
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ """;
final String cannedResponseForApplication2 =
- "{\n" +
- " \"nodes\": [\n" +
- " {\n" +
- " \"hostname\": \"host-3.yahoo.com\",\n" +
- " \"role\": \"role0\",\n" +
- " \"node\": {\n" +
- " \"timestamp\": 1300,\n" +
- " \"metrics\": [\n" +
- " {\n" +
- " \"values\": {\n" +
- " \"cpu.util\": 10,\n" +
- " \"mem.util\": 15,\n" +
- " \"disk.util\": 20,\n" +
- " \"application_generation\": 3\n" +
- " },\n" +
- " \"dimensions\": {\n" +
- " \"state\": \"active\"\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- "}\n";
+ """
+ {
+ "nodes": [
+ {
+ "hostname": "host-3.yahoo.com",
+ "role": "role0",
+ "node": {
+ "timestamp": 1300,
+ "metrics": [
+ {
+ "values": {
+ "cpu.util": 10,
+ "mem.util": 15,
+ "disk.util": 20,
+ "application_generation.last": 3,
+ "in_service.last": 0
+ },
+ "dimensions": {
+ "state": "active"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ """;
}
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeMetricsDbMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeMetricsDbMaintainerTest.java
index d379513a8f9..c7c6e770fe3 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeMetricsDbMaintainerTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeMetricsDbMaintainerTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
+ * @author bratseth
*/
public class NodeMetricsDbMaintainerTest {
@@ -56,53 +57,56 @@ public class NodeMetricsDbMaintainerTest {
private static class MockHttpClient implements MetricsV2MetricsFetcher.AsyncHttpClient {
+ // this value asserted on above
final String cannedResponse =
- "{\n" +
- " \"nodes\": [\n" +
- " {\n" +
- " \"hostname\": \"host-1.yahoo.com\",\n" +
- " \"role\": \"role0\",\n" +
- " \"node\": {\n" +
- " \"timestamp\": 1300,\n" +
- " \"metrics\": [\n" +
- " {\n" +
- " \"values\": {\n" +
- " \"cpu.util\": 14,\n" + // this value asserted on above
- " \"mem_total.util\": 15,\n" +
- " \"disk.util\": 20,\n" +
- " \"application_generation\": 3,\n" +
- " \"in_service\": 1\n" +
- " },\n" +
- " \"dimensions\": {\n" +
- " \"state\": \"active\"\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " },\n" +
- " {\n" +
- " \"hostname\": \"host-2.yahoo.com\",\n" +
- " \"role\": \"role0\",\n" +
- " \"node\": {\n" +
- " \"timestamp\": 1300,\n" +
- " \"metrics\": [\n" +
- " {\n" +
- " \"values\": {\n" +
- " \"cpu.util\": 1,\n" +
- " \"mem_total.util\": 2,\n" +
- " \"disk.util\": 3,\n" +
- " \"application_generation\": 3,\n" +
- " \"in_service\": 0\n" +
- " },\n" +
- " \"dimensions\": {\n" +
- " \"state\": \"active\"\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- "}\n";
+ """
+ {
+ "nodes": [
+ {
+ "hostname": "host-1.yahoo.com",
+ "role": "role0",
+ "node": {
+ "timestamp": 1300,
+ "metrics": [
+ {
+ "values": {
+ "cpu.util": 14,
+ "mem_total.util": 15,
+ "disk.util": 20,
+ "application_generation.last": 3,
+ "in_service.last": 1
+ },
+ "dimensions": {
+ "state": "active"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "hostname": "host-2.yahoo.com",
+ "role": "role0",
+ "node": {
+ "timestamp": 1300,
+ "metrics": [
+ {
+ "values": {
+ "cpu.util": 1,
+ "mem_total.util": 2,
+ "disk.util": 3,
+ "application_generation.last": 3,
+ "in_service.last": 0
+ },
+ "dimensions": {
+ "state": "active"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ """;
@Override
public CompletableFuture<String> get(String url) {