aboutsummaryrefslogtreecommitdiffstats
path: root/metrics-proxy/src/main/java/ai/vespa
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2021-12-15 14:54:31 +0100
committerGitHub <noreply@github.com>2021-12-15 14:54:31 +0100
commit2d00d7e5d3190a70496d3ffaa846707852b8a062 (patch)
tree81c54af3ee6e4b2dfca9581af21fb8e37dfb2366 /metrics-proxy/src/main/java/ai/vespa
parentba5b8272df1b678290bd1cc9ae8bf2f27d056291 (diff)
parentd0dd094291b43a69fdb1ad4131dad91cca40e9b0 (diff)
Merge pull request #20525 from vespa-engine/bratseth/cleanup-654
No functional changes
Diffstat (limited to 'metrics-proxy/src/main/java/ai/vespa')
-rw-r--r--metrics-proxy/src/main/java/ai/vespa/metricsproxy/core/VespaMetrics.java2
-rw-r--r--metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/Metrics.java30
-rw-r--r--metrics-proxy/src/main/java/ai/vespa/metricsproxy/node/NodeMetricGatherer.java2
3 files changed, 4 insertions, 30 deletions
diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/core/VespaMetrics.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/core/VespaMetrics.java
index 3629e81582a..7a3f260cd34 100644
--- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/core/VespaMetrics.java
+++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/core/VespaMetrics.java
@@ -171,7 +171,7 @@ public class VespaMetrics {
builder.putDimension(METRIC_TYPE_DIMENSION_ID, "system")
.putDimension(INSTANCE_DIMENSION_ID, service.getInstanceName())
.putDimensions(service.getDimensions())
- .putMetrics(systemMetrics.getMetrics());
+ .putMetrics(systemMetrics.list());
builder.addConsumers(metricsConsumers.getAllConsumers());
return Optional.of(builder);
diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/Metrics.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/Metrics.java
index 571ffc030de..8450d9f6be7 100644
--- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/Metrics.java
+++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/Metrics.java
@@ -1,16 +1,12 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.metricsproxy.metric;
-import ai.vespa.metricsproxy.metric.model.MetricId;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Once a getter is called, the instance is frozen and no more metrics can be added.
- *
- * @author Unknown
*/
// TODO: remove timestamp, only used as temporary storage.
// TODO: instances of this class can probably be replaced by a simple freezable map.
@@ -52,37 +48,17 @@ public class Metrics {
this.metrics.add(m);
}
- /**
- * Get the size of the metrics covered. Note that this might also contain expired metrics
- *
- * @return size of metrics
- */
+ /** Returns the size of the metrics covered. Note that this might also contain expired metrics. */
public int size() {
return this.metrics.size();
}
- /**
- * TODO: Remove, might be multiple metrics with same name but different dimensions
- *
- * @param key metric name
- * @return the metric, or null
- */
- public Metric getMetric(MetricId key) {
- isFrozen = true;
- for (Metric m: metrics) {
- if (m.getName().equals(key)) {
- return m;
- }
- }
- return null;
- }
-
- public List<Metric> getMetrics() {
+ public List<Metric> list() {
isFrozen = true;
return Collections.unmodifiableList(metrics);
}
-
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (Metric m : metrics) {
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 5aa95e9efc0..9686bb1bf6b 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
@@ -30,8 +30,6 @@ import static ai.vespa.metricsproxy.node.ServiceHealthGatherer.gatherServiceHeal
*
* @author olaa
*/
-
-
public class NodeMetricGatherer {
private final VespaServices vespaServices;