diff options
author | gjoranv <gv@verizonmedia.com> | 2020-01-17 13:33:18 +0100 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2020-01-17 13:33:18 +0100 |
commit | f9e7cdf92ad1867ed7ed7813fe0577a061c000e9 (patch) | |
tree | 3fd65690ba4cd2e7dd1dba295cc192fb9cdb56ad /metrics-proxy | |
parent | ca80f4634d471c078047337e1d10a7f73c163900 (diff) |
Move MetricsHandler to new package and add 'V1' to its name.
Diffstat (limited to 'metrics-proxy')
-rw-r--r-- | metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/metrics/MetricsV1Handler.java (renamed from metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/MetricsHandler.java) | 16 | ||||
-rw-r--r-- | metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/NodeMetricsClientTest.java | 4 | ||||
-rw-r--r-- | metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/metrics/MetricsV1HandlerTest.java (renamed from metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/MetricsHandlerTest.java) | 17 |
3 files changed, 21 insertions, 16 deletions
diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/MetricsHandler.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/metrics/MetricsV1Handler.java index c4360545806..28a24c5dc25 100644 --- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/MetricsHandler.java +++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/metrics/MetricsV1Handler.java @@ -1,8 +1,12 @@ // Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.metricsproxy.http; +package ai.vespa.metricsproxy.http.metrics; import ai.vespa.metricsproxy.core.MetricsConsumers; import ai.vespa.metricsproxy.core.MetricsManager; +import ai.vespa.metricsproxy.http.ErrorResponse; +import ai.vespa.metricsproxy.http.HttpHandlerBase; +import ai.vespa.metricsproxy.http.JsonResponse; +import ai.vespa.metricsproxy.http.ValuesFetcher; import ai.vespa.metricsproxy.metric.model.MetricsPacket; import ai.vespa.metricsproxy.service.VespaServices; import com.google.inject.Inject; @@ -24,7 +28,7 @@ import static com.yahoo.jdisc.Response.Status.OK; * * @author gjoranv */ -public class MetricsHandler extends HttpHandlerBase { +public class MetricsV1Handler extends HttpHandlerBase { public static final String V1_PATH = "/metrics/v1"; public static final String VALUES_PATH = V1_PATH + "/values"; @@ -32,10 +36,10 @@ public class MetricsHandler extends HttpHandlerBase { private final ValuesFetcher valuesFetcher; @Inject - public MetricsHandler(Executor executor, - MetricsManager metricsManager, - VespaServices vespaServices, - MetricsConsumers metricsConsumers) { + public MetricsV1Handler(Executor executor, + MetricsManager metricsManager, + VespaServices vespaServices, + MetricsConsumers metricsConsumers) { super(executor); valuesFetcher = new ValuesFetcher(metricsManager, vespaServices, metricsConsumers); } 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 0c800c0ff63..c3e34920163 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 @@ -1,7 +1,7 @@ // Copyright 2020 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 ai.vespa.metricsproxy.http.MetricsHandler; +import ai.vespa.metricsproxy.http.metrics.MetricsV1Handler; import ai.vespa.metricsproxy.metric.model.MetricsPacket; import com.github.tomakehurst.wiremock.junit.WireMockClassRule; import com.yahoo.test.ManualClock; @@ -55,7 +55,7 @@ public class NodeMetricsClientTest { @BeforeClass public static void setupWireMock() { - node = new Node("id", "localhost", wireMockRule.port(), MetricsHandler.VALUES_PATH); + node = new Node("id", "localhost", wireMockRule.port(), MetricsV1Handler.VALUES_PATH); URI metricsUri = node.metricsUri(DEFAULT_PUBLIC_CONSUMER_ID); wireMockRule.stubFor(get(urlPathEqualTo(metricsUri.getPath())) .willReturn(aResponse().withBody(RESPONSE))); diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/MetricsHandlerTest.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/metrics/MetricsV1HandlerTest.java index 1444f5c57f5..22f61114622 100644 --- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/MetricsHandlerTest.java +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/metrics/MetricsV1HandlerTest.java @@ -1,6 +1,7 @@ // Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.metricsproxy.http; +package ai.vespa.metricsproxy.http.metrics; +import ai.vespa.metricsproxy.http.HttpHandlerTestBase; import ai.vespa.metricsproxy.metric.model.json.GenericJsonModel; import ai.vespa.metricsproxy.metric.model.json.GenericMetrics; import ai.vespa.metricsproxy.metric.model.json.GenericService; @@ -17,8 +18,8 @@ import java.io.IOException; import java.util.concurrent.Executors; import static ai.vespa.metricsproxy.core.VespaMetrics.INSTANCE_DIMENSION_ID; -import static ai.vespa.metricsproxy.http.MetricsHandler.V1_PATH; -import static ai.vespa.metricsproxy.http.MetricsHandler.VALUES_PATH; +import static ai.vespa.metricsproxy.http.metrics.MetricsV1Handler.V1_PATH; +import static ai.vespa.metricsproxy.http.metrics.MetricsV1Handler.VALUES_PATH; import static ai.vespa.metricsproxy.metric.model.StatusCode.DOWN; import static ai.vespa.metricsproxy.metric.model.json.JacksonUtil.createObjectMapper; import static ai.vespa.metricsproxy.service.DummyService.METRIC_1; @@ -33,17 +34,17 @@ import static org.junit.Assert.fail; * @author gjoranv */ @SuppressWarnings("UnstableApiUsage") -public class MetricsHandlerTest extends HttpHandlerTestBase { +public class MetricsV1HandlerTest extends HttpHandlerTestBase { private static final String V1_URI = URI_BASE + V1_PATH; private static final String VALUES_URI = URI_BASE + VALUES_PATH; @BeforeClass public static void setup() { - MetricsHandler handler = new MetricsHandler(Executors.newSingleThreadExecutor(), - getMetricsManager(), - vespaServices, - getMetricsConsumers()); + var handler = new MetricsV1Handler(Executors.newSingleThreadExecutor(), + getMetricsManager(), + vespaServices, + getMetricsConsumers()); testDriver = new RequestHandlerTestDriver(handler); } |