From ec6ae933e5179e6116feda2fe51d7277d89c8d55 Mon Sep 17 00:00:00 2001 From: gjoranv Date: Fri, 3 Jan 2020 11:30:54 +0100 Subject: Remove convenience method that did not take consumer argument. --- .../vespa/metricsproxy/http/application/NodeMetricsClient.java | 7 +------ .../metricsproxy/http/application/NodeMetricsClientTest.java | 10 +++++----- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'metrics-proxy') diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/NodeMetricsClient.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/NodeMetricsClient.java index d1ff47f3c3f..8b397bc65f8 100644 --- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/NodeMetricsClient.java +++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/NodeMetricsClient.java @@ -21,7 +21,6 @@ import java.util.List; import java.util.Map; import java.util.logging.Logger; -import static ai.vespa.metricsproxy.http.ValuesFetcher.DEFAULT_PUBLIC_CONSUMER_ID; import static com.yahoo.log.LogLevel.DEBUG; import static java.util.Collections.emptyList; @@ -47,16 +46,12 @@ public class NodeMetricsClient { private final Map snapshots = new HashMap<>(); private long snapshotsRetrieved = 0; - public NodeMetricsClient(HttpClient httpClient, Node node, Clock clock) { + NodeMetricsClient(HttpClient httpClient, Node node, Clock clock) { this.httpClient = httpClient; this.node = node; this.clock = clock; } - public List getMetrics() { - return getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); - } - public List getMetrics(ConsumerId consumer) { var currentSnapshot = snapshots.get(consumer); if (currentSnapshot == null || currentSnapshot.isStale(clock) || currentSnapshot.metrics.isEmpty()) { diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/NodeMetricsClientTest.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/NodeMetricsClientTest.java index 6c319a4d74c..0c0b0749011 100644 --- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/NodeMetricsClientTest.java +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/NodeMetricsClientTest.java @@ -88,28 +88,28 @@ public class NodeMetricsClientTest { @Test public void metrics_are_retrieved_upon_first_request() { - List metrics = nodeMetricsClient.getMetrics(); + List metrics = nodeMetricsClient.getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); assertEquals(1, nodeMetricsClient.snapshotsRetrieved()); assertEquals(4, metrics.size()); } @Test public void cached_metrics_are_used_when_ttl_has_not_expired() { - nodeMetricsClient.getMetrics(); + nodeMetricsClient.getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); assertEquals(1, nodeMetricsClient.snapshotsRetrieved()); clock.advance(NodeMetricsClient.METRICS_TTL.minusMillis(1)); - nodeMetricsClient.getMetrics(); + nodeMetricsClient.getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); assertEquals(1, nodeMetricsClient.snapshotsRetrieved()); } @Test public void metrics_are_refreshed_when_ttl_has_expired() { - nodeMetricsClient.getMetrics(); + nodeMetricsClient.getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); assertEquals(1, nodeMetricsClient.snapshotsRetrieved()); clock.advance(NodeMetricsClient.METRICS_TTL.plusMillis(1)); - nodeMetricsClient.getMetrics(); + nodeMetricsClient.getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); assertEquals(2, nodeMetricsClient.snapshotsRetrieved()); } -- cgit v1.2.3