summaryrefslogtreecommitdiffstats
path: root/metrics-proxy/src/main
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2019-12-16 15:45:35 +0100
committergjoranv <gv@verizonmedia.com>2019-12-19 12:05:04 +0100
commit7a915cf61dd3e190a1eb5502715759c9c6e200ff (patch)
tree8074ef65ffbd035c69c423fad9cf7aac295ff92c /metrics-proxy/src/main
parent3132a02b3ec2d3a8fca89527d7fb046615d245ed (diff)
Move Node class to separate file, and add path field.
Diffstat (limited to 'metrics-proxy/src/main')
-rw-r--r--metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/Node.java35
-rw-r--r--metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/NodeMetricsClient.java22
2 files changed, 35 insertions, 22 deletions
diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/Node.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/Node.java
new file mode 100644
index 00000000000..06bb2e890ea
--- /dev/null
+++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/Node.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+ */
+
+package ai.vespa.metricsproxy.http.application;
+
+import java.net.URI;
+
+/**
+ * Represents a node to retrieve metrics from.
+ *
+ * @author gjoranv
+ */
+public class Node {
+
+ final String configId;
+ final String host;
+ final int port;
+ final String path;
+
+ final URI metricsUri;
+
+ public Node(String configId, String host, int port, String path) {
+ this.configId = configId;
+ this.host = host;
+ this.port = port;
+ this.path = path;
+ metricsUri = getMetricsUri(host, port, path);
+ }
+
+ private static URI getMetricsUri(String host, int port, String path) {
+ return URI.create("http://" + host + ":" + port + path);
+ }
+
+}
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 28130380c13..34ee38d44f2 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
@@ -4,7 +4,6 @@
package ai.vespa.metricsproxy.http.application;
-import ai.vespa.metricsproxy.http.MetricsHandler;
import ai.vespa.metricsproxy.metric.model.MetricsPacket;
import ai.vespa.metricsproxy.metric.model.json.GenericJsonUtil;
import com.yahoo.yolean.Exceptions;
@@ -13,7 +12,6 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import java.io.IOException;
-import java.net.URI;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
@@ -76,24 +74,4 @@ public class NodeMetricsClient {
return snapshotsRetrieved;
}
- // TODO: move to separate file
- static class Node {
- final String configId;
- final String host;
- final int port;
- final URI metricsUri;
-
- public Node(String configId, String host, int port) {
- this.configId = configId;
- this.host = host;
- this.port = port;
- metricsUri = getMetricsUri(host, port);
- }
-
- private static URI getMetricsUri(String host, int port) {
- return URI.create("http://" + host + ":" + port + MetricsHandler.VALUES_PATH);
- }
-
- }
-
}