diff options
author | Ola Aunrønning <olaa@verizonmedia.com> | 2022-08-15 15:46:57 +0200 |
---|---|---|
committer | Ola Aunrønning <olaa@verizonmedia.com> | 2022-08-15 15:46:57 +0200 |
commit | a96ebf411cc18c968ddd0368bd639d0d654f8276 (patch) | |
tree | 958e10b4aa4083106b6657d47e066dcf41e70634 /metrics-proxy | |
parent | f552ae6e444470948533353a0371f2c57e8dcdf2 (diff) |
Add Vespa consumer to host life metric
Diffstat (limited to 'metrics-proxy')
-rw-r--r-- | metrics-proxy/src/main/java/ai/vespa/metricsproxy/node/NodeMetricGatherer.java | 3 | ||||
-rw-r--r-- | metrics-proxy/src/test/java/ai/vespa/metricsproxy/node/NodeMetricGathererTest.java | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/node/NodeMetricGatherer.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/node/NodeMetricGatherer.java index e18ea374fe1..148f48136f4 100644 --- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/node/NodeMetricGatherer.java +++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/node/NodeMetricGatherer.java @@ -4,6 +4,7 @@ package ai.vespa.metricsproxy.node; import ai.vespa.metricsproxy.core.MetricsManager; import ai.vespa.metricsproxy.metric.dimensions.ApplicationDimensions; import ai.vespa.metricsproxy.metric.dimensions.NodeDimensions; +import ai.vespa.metricsproxy.metric.model.ConsumerId; import ai.vespa.metricsproxy.metric.model.MetricId; import ai.vespa.metricsproxy.metric.model.MetricsPacket; import ai.vespa.metricsproxy.metric.model.ServiceId; @@ -18,6 +19,7 @@ import com.yahoo.container.jdisc.state.HostLifeGatherer; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import static ai.vespa.metricsproxy.node.ServiceHealthGatherer.gatherServiceHealthMetrics; @@ -78,6 +80,7 @@ public class NodeMetricGatherer { builder.putMetric(MetricId.toMetricId(key), metrics.get(key).asLong()); } } + builder.addConsumers(Set.of(ConsumerId.toConsumerId("Vespa"))); builders.add(builder); } diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/node/NodeMetricGathererTest.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/node/NodeMetricGathererTest.java index c693e9690e8..0de3526b40d 100644 --- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/node/NodeMetricGathererTest.java +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/node/NodeMetricGathererTest.java @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package ai.vespa.metricsproxy.node; +import ai.vespa.metricsproxy.metric.model.ConsumerId; import ai.vespa.metricsproxy.metric.model.MetricId; import ai.vespa.metricsproxy.metric.model.MetricsPacket; import com.fasterxml.jackson.databind.JsonNode; @@ -10,6 +11,7 @@ import org.junit.Test; import java.util.ArrayList; import java.util.List; +import java.util.Set; import static org.junit.Assert.assertEquals; @@ -33,6 +35,7 @@ public class NodeMetricGathererTest { assertEquals(123, packet.timestamp); assertEquals(12l, packet.metrics().get(MetricId.toMetricId("uptime"))); assertEquals(1l, packet.metrics().get(MetricId.toMetricId("alive"))); + assertEquals(Set.of(ConsumerId.toConsumerId("Vespa")), packet.consumers()); } private JsonNode generateHostLifePacket() { |