diff options
author | Jon Bratseth <bratseth@gmail.com> | 2020-09-18 12:10:24 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2020-09-18 12:10:24 +0200 |
commit | 7b7c1a98a4b963473c1fc7f4808744bad16e09cf (patch) | |
tree | b38434424f0c5031619e31fbfe9183b908348ff6 /metrics-proxy | |
parent | 10a2ad59ec78891a351f07e0163e075757951e9b (diff) |
No functional changes
Diffstat (limited to 'metrics-proxy')
14 files changed, 46 insertions, 49 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 c04dca465a1..b895d6221c3 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 @@ -21,7 +21,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; -import java.util.logging.Logger; import java.util.stream.Collectors; import static ai.vespa.metricsproxy.metric.dimensions.PublicDimensions.INTERNAL_SERVICE_ID; @@ -31,14 +30,11 @@ import static ai.vespa.metricsproxy.metric.model.ServiceId.toServiceId; import static com.google.common.base.Strings.isNullOrEmpty; /** - * @author Unknown * @author gjoranv */ public class VespaMetrics { - private static final Logger log = Logger.getLogger(VespaMetrics.class.getPackage().getName()); - - public static final ConsumerId VESPA_CONSUMER_ID = toConsumerId("Vespa"); + public static final ConsumerId vespaMetricsConsumerId = toConsumerId("Vespa"); public static final DimensionId METRIC_TYPE_DIMENSION_ID = toDimensionId("metrictype"); public static final DimensionId INSTANCE_DIMENSION_ID = toDimensionId(INTERNAL_SERVICE_ID); @@ -68,8 +64,8 @@ public class VespaMetrics { } /** - * @param services The services to get metrics for - * @return A list of metrics packet builders (to allow modification by the caller). + * @param services the services to get metrics for + * @return a list of metrics packet builders (to allow modification by the caller) */ public List<MetricsPacket.Builder> getMetrics(List<VespaService> services) { List<MetricsPacket.Builder> metricsPackets = new ArrayList<>(); @@ -253,7 +249,7 @@ public class VespaMetrics { String alias = key; boolean isForwarded = false; - for (ConsumersConfig.Consumer.Metric metricConsumer : getMetricDefinitions(VESPA_CONSUMER_ID)) { + for (ConsumersConfig.Consumer.Metric metricConsumer : getMetricDefinitions(vespaMetricsConsumerId)) { if (metricConsumer.name().equals(key)) { alias = metricConsumer.outputname(); isForwarded = true; diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/ValuesFetcher.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/ValuesFetcher.java index 51bdae1aab3..cf2f6210f39 100644 --- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/ValuesFetcher.java +++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/ValuesFetcher.java @@ -24,7 +24,7 @@ public class ValuesFetcher { private static final Logger log = Logger.getLogger(ValuesFetcher.class.getName()); - public static final ConsumerId DEFAULT_PUBLIC_CONSUMER_ID = toConsumerId("default"); + public static final ConsumerId defaultMetricsConsumerId = toConsumerId("default"); private final MetricsManager metricsManager; private final VespaServices vespaServices; @@ -62,12 +62,12 @@ public class ValuesFetcher { } public static ConsumerId getConsumerOrDefault(String requestedConsumer, MetricsConsumers consumers) { - if (requestedConsumer == null) return DEFAULT_PUBLIC_CONSUMER_ID; + if (requestedConsumer == null) return defaultMetricsConsumerId; ConsumerId consumerId = toConsumerId(requestedConsumer); if (! consumers.getAllConsumers().contains(consumerId)) { log.info("No consumer with id '" + requestedConsumer + "' - using the default consumer instead."); - return DEFAULT_PUBLIC_CONSUMER_ID; + return defaultMetricsConsumerId; } return consumerId; } diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetriever.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetriever.java index 5c7e64c4ed1..15f924505be 100644 --- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetriever.java +++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetriever.java @@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Logger; import java.util.stream.Collectors; -import static ai.vespa.metricsproxy.http.ValuesFetcher.DEFAULT_PUBLIC_CONSUMER_ID; +import static ai.vespa.metricsproxy.http.ValuesFetcher.defaultMetricsConsumerId; import static java.util.Collections.emptyList; import static java.util.stream.Collectors.toMap; @@ -50,7 +50,6 @@ public class ApplicationMetricsRetriever extends AbstractComponent { // Non-final for testing private Duration taskTimeout; - @Inject public ApplicationMetricsRetriever(MetricsNodesConfig nodesConfig) { clients = createNodeClients(nodesConfig); @@ -66,7 +65,7 @@ public class ApplicationMetricsRetriever extends AbstractComponent { } public Map<Node, List<MetricsPacket>> getMetrics() { - return getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); + return getMetrics(defaultMetricsConsumerId); } public Map<Node, List<MetricsPacket>> getMetrics(ConsumerId consumer) { diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/MetricsPacket.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/MetricsPacket.java index 8d5a1f50918..2d5cd9acb5d 100644 --- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/MetricsPacket.java +++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/MetricsPacket.java @@ -29,6 +29,7 @@ import static java.util.stream.Collectors.joining; * @author gjoranv */ public class MetricsPacket { + public final int statusCode; public final String statusMessage; public final long timestamp; @@ -80,7 +81,8 @@ public class MetricsPacket { } public static class Builder { - // Set sensible defaults here, and use null guard in all setters. + + // Set defaults here, and use null guard in all setters. // Except for 'service' for which we require an explicit non-null value. private ServiceId service; private int statusCode = 0; diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/json/YamasJsonUtil.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/json/YamasJsonUtil.java index d2838d5b1d2..d71b11a4ff2 100644 --- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/json/YamasJsonUtil.java +++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/json/YamasJsonUtil.java @@ -16,7 +16,7 @@ import java.util.Map; import java.util.logging.Logger; import java.util.stream.Collectors; -import static ai.vespa.metricsproxy.http.ValuesFetcher.DEFAULT_PUBLIC_CONSUMER_ID; +import static ai.vespa.metricsproxy.http.ValuesFetcher.defaultMetricsConsumerId; import static ai.vespa.metricsproxy.metric.model.ServiceId.toServiceId; import static com.yahoo.stream.CustomCollectors.toLinkedMap; import static java.util.Collections.emptyList; @@ -123,7 +123,7 @@ public class YamasJsonUtil { private static YamasJsonModel.YamasJsonNamespace toYamasJsonNamespaces(Collection<ConsumerId> consumers) { YamasJsonModel.YamasJsonNamespace namespaces = new YamasJsonModel.YamasJsonNamespace(); namespaces.namespaces = consumers.stream() - .filter(consumerId -> consumerId != DEFAULT_PUBLIC_CONSUMER_ID) + .filter(consumerId -> consumerId != defaultMetricsConsumerId) .map(consumer -> consumer.id) .collect(Collectors.toList()); return namespaces; diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/node/ServiceHealthGatherer.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/node/ServiceHealthGatherer.java index 923fb4d646d..a11acf07156 100644 --- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/node/ServiceHealthGatherer.java +++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/node/ServiceHealthGatherer.java @@ -12,13 +12,11 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; - /** * @author olaa */ public class ServiceHealthGatherer { - protected static List<MetricsPacket.Builder> gatherServiceHealthMetrics(VespaServices vespaServices) { return vespaServices.getVespaServices() .stream() @@ -33,4 +31,5 @@ public class ServiceHealthGatherer { ) .collect(Collectors.toList()); } + } diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/TestUtil.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/TestUtil.java index e067639023d..27ac3bbab01 100644 --- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/TestUtil.java +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/TestUtil.java @@ -35,4 +35,5 @@ public class TestUtil { } return new BufferedReader(new InputStreamReader(in)).lines().collect(Collectors.joining("\n")); } + } diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/core/MetricsManagerTest.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/core/MetricsManagerTest.java index f21774aeb15..fd1961fc168 100644 --- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/core/MetricsManagerTest.java +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/core/MetricsManagerTest.java @@ -28,7 +28,7 @@ import java.util.Map; import static ai.vespa.metricsproxy.core.MetricsManager.VESPA_VERSION; import static ai.vespa.metricsproxy.core.VespaMetrics.METRIC_TYPE_DIMENSION_ID; -import static ai.vespa.metricsproxy.core.VespaMetrics.VESPA_CONSUMER_ID; +import static ai.vespa.metricsproxy.core.VespaMetrics.vespaMetricsConsumerId; import static ai.vespa.metricsproxy.metric.ExternalMetrics.ROLE_DIMENSION; import static ai.vespa.metricsproxy.metric.model.DimensionId.toDimensionId; import static ai.vespa.metricsproxy.metric.model.MetricId.toMetricId; @@ -241,7 +241,7 @@ public class MetricsManagerTest { return new MetricsConsumers(new ConsumersConfig.Builder() .consumer(new Consumer.Builder() - .name(VESPA_CONSUMER_ID.id) + .name(vespaMetricsConsumerId.id) .metric(new Consumer.Metric.Builder() .name(WHITELISTED_METRIC_ID) .outputname(WHITELISTED_METRIC_ID)) diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/HttpHandlerTestBase.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/HttpHandlerTestBase.java index d776368687d..ab586334baa 100644 --- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/HttpHandlerTestBase.java +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/HttpHandlerTestBase.java @@ -22,7 +22,7 @@ import com.yahoo.container.jdisc.RequestHandlerTestDriver; import java.time.Instant; import java.util.List; -import static ai.vespa.metricsproxy.http.ValuesFetcher.DEFAULT_PUBLIC_CONSUMER_ID; +import static ai.vespa.metricsproxy.http.ValuesFetcher.defaultMetricsConsumerId; import static ai.vespa.metricsproxy.metric.ExternalMetrics.VESPA_NODE_SERVICE_ID; import static ai.vespa.metricsproxy.metric.dimensions.PublicDimensions.REASON; import static ai.vespa.metricsproxy.service.DummyService.METRIC_1; @@ -71,7 +71,7 @@ public class HttpHandlerTestBase { return new MetricsConsumers(new ConsumersConfig.Builder() .consumer(new ConsumersConfig.Consumer.Builder() - .name(DEFAULT_PUBLIC_CONSUMER_ID.id) + .name(defaultMetricsConsumerId.id) .metric(new ConsumersConfig.Consumer.Metric.Builder() .name(CPU_METRIC) .outputname(CPU_METRIC)) diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsHandlerTest.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsHandlerTest.java index 0fa6fea7d11..d7576718e8a 100644 --- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsHandlerTest.java +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsHandlerTest.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.junit.WireMockRule; import com.yahoo.container.jdisc.RequestHandlerTestDriver; import java.util.regex.Pattern; -import java.util.stream.Collectors; + import org.json.JSONArray; import org.json.JSONObject; import org.junit.Before; @@ -26,7 +26,7 @@ import java.util.Map; import java.util.concurrent.Executors; import static ai.vespa.metricsproxy.TestUtil.getFileContents; -import static ai.vespa.metricsproxy.http.ValuesFetcher.DEFAULT_PUBLIC_CONSUMER_ID; +import static ai.vespa.metricsproxy.http.ValuesFetcher.defaultMetricsConsumerId; import static ai.vespa.metricsproxy.http.application.ApplicationMetricsHandler.METRICS_V1_PATH; import static ai.vespa.metricsproxy.http.application.ApplicationMetricsHandler.METRICS_VALUES_PATH; import static ai.vespa.metricsproxy.http.application.ApplicationMetricsHandler.PROMETHEUS_VALUES_PATH; @@ -89,7 +89,7 @@ public class ApplicationMetricsHandlerTest { private void setupWireMock() { port = wireMockRule.port(); wireMockRule.stubFor(get(urlPathEqualTo(MOCK_METRICS_PATH)) - .withQueryParam("consumer", equalTo(DEFAULT_PUBLIC_CONSUMER_ID.id)) + .withQueryParam("consumer", equalTo(defaultMetricsConsumerId.id)) .willReturn(aResponse().withBody(RESPONSE))); // Add a slightly different response for a custom consumer. @@ -132,7 +132,7 @@ public class ApplicationMetricsHandlerTest { @Test public void response_contains_node() { - GenericApplicationModel jsonModel = getResponseAsJsonModel(DEFAULT_PUBLIC_CONSUMER_ID.id); + GenericApplicationModel jsonModel = getResponseAsJsonModel(defaultMetricsConsumerId.id); assertEquals(1, jsonModel.nodes.size()); GenericJsonModel nodeModel = jsonModel.nodes.get(0); @@ -161,7 +161,7 @@ public class ApplicationMetricsHandlerTest { @Test public void response_contains_services_with_metrics() { - GenericApplicationModel jsonModel = getResponseAsJsonModel(DEFAULT_PUBLIC_CONSUMER_ID.id); + GenericApplicationModel jsonModel = getResponseAsJsonModel(defaultMetricsConsumerId.id); GenericJsonModel nodeModel = jsonModel.nodes.get(0); assertEquals(2, nodeModel.services.size()); @@ -174,7 +174,7 @@ public class ApplicationMetricsHandlerTest { @Test public void metrics_processors_are_applied() { - GenericApplicationModel jsonModel = getResponseAsJsonModel(DEFAULT_PUBLIC_CONSUMER_ID.id); + GenericApplicationModel jsonModel = getResponseAsJsonModel(defaultMetricsConsumerId.id); GenericService searchnode = jsonModel.nodes.get(0).services.get(0); Map<String, String> dimensions = searchnode.metrics.get(0).dimensions; @@ -233,7 +233,7 @@ public class ApplicationMetricsHandlerTest { private static MetricsConsumers getMetricsConsumers() { return new MetricsConsumers(new ConsumersConfig.Builder() .consumer(new ConsumersConfig.Consumer.Builder() - .name(DEFAULT_PUBLIC_CONSUMER_ID.id)) + .name(defaultMetricsConsumerId.id)) .consumer(new ConsumersConfig.Consumer.Builder() .name(CUSTOM_CONSUMER)) .build()); 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 d8443ece8e8..eba32941620 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 @@ -16,7 +16,7 @@ import java.net.URI; import java.util.List; import static ai.vespa.metricsproxy.TestUtil.getFileContents; -import static ai.vespa.metricsproxy.http.ValuesFetcher.DEFAULT_PUBLIC_CONSUMER_ID; +import static ai.vespa.metricsproxy.http.ValuesFetcher.defaultMetricsConsumerId; import static ai.vespa.metricsproxy.metric.model.ConsumerId.toConsumerId; import static ai.vespa.metricsproxy.metric.model.MetricId.toMetricId; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; @@ -56,12 +56,12 @@ public class NodeMetricsClientTest { @BeforeClass public static void setupWireMock() { node = new Node("id", "localhost", wireMockRule.port(), MetricsV1Handler.VALUES_PATH); - URI metricsUri = node.metricsUri(DEFAULT_PUBLIC_CONSUMER_ID); + URI metricsUri = node.metricsUri(defaultMetricsConsumerId); wireMockRule.stubFor(get(urlPathEqualTo(metricsUri.getPath())) .willReturn(aResponse().withBody(RESPONSE))); wireMockRule.stubFor(get(urlPathEqualTo(metricsUri.getPath())) - .withQueryParam("consumer", equalTo(DEFAULT_PUBLIC_CONSUMER_ID.id)) + .withQueryParam("consumer", equalTo(defaultMetricsConsumerId.id)) .willReturn(aResponse().withBody(RESPONSE))); // Add a slightly different response for a custom consumer. @@ -85,34 +85,34 @@ public class NodeMetricsClientTest { @Test public void metrics_are_retrieved_upon_first_request() { - List<MetricsPacket> metrics = nodeMetricsClient.getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); + List<MetricsPacket> metrics = nodeMetricsClient.getMetrics(defaultMetricsConsumerId); assertEquals(1, nodeMetricsClient.snapshotsRetrieved()); assertEquals(4, metrics.size()); } @Test public void cached_metrics_are_used_when_ttl_has_not_expired() { - nodeMetricsClient.getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); + nodeMetricsClient.getMetrics(defaultMetricsConsumerId); assertEquals(1, nodeMetricsClient.snapshotsRetrieved()); clock.advance(NodeMetricsClient.METRICS_TTL.minusMillis(1)); - nodeMetricsClient.getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); + nodeMetricsClient.getMetrics(defaultMetricsConsumerId); assertEquals(1, nodeMetricsClient.snapshotsRetrieved()); } @Test public void metrics_are_refreshed_when_ttl_has_expired() { - nodeMetricsClient.getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); + nodeMetricsClient.getMetrics(defaultMetricsConsumerId); assertEquals(1, nodeMetricsClient.snapshotsRetrieved()); clock.advance(NodeMetricsClient.METRICS_TTL.plusMillis(1)); - nodeMetricsClient.getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); + nodeMetricsClient.getMetrics(defaultMetricsConsumerId); assertEquals(2, nodeMetricsClient.snapshotsRetrieved()); } @Test public void metrics_for_different_consumers_are_cached_separately() { - List<MetricsPacket> defaultMetrics = nodeMetricsClient.getMetrics(DEFAULT_PUBLIC_CONSUMER_ID); + List<MetricsPacket> defaultMetrics = nodeMetricsClient.getMetrics(defaultMetricsConsumerId); assertEquals(1, nodeMetricsClient.snapshotsRetrieved()); assertEquals(4, defaultMetrics.size()); diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/metric/model/json/YamasJsonUtilTest.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/metric/model/json/YamasJsonUtilTest.java index d3a5622d263..67430e50e10 100644 --- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/metric/model/json/YamasJsonUtilTest.java +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/metric/model/json/YamasJsonUtilTest.java @@ -7,8 +7,8 @@ import org.junit.Test; import java.util.List; import java.util.Set; -import static ai.vespa.metricsproxy.core.VespaMetrics.VESPA_CONSUMER_ID; -import static ai.vespa.metricsproxy.http.ValuesFetcher.DEFAULT_PUBLIC_CONSUMER_ID; +import static ai.vespa.metricsproxy.core.VespaMetrics.vespaMetricsConsumerId; +import static ai.vespa.metricsproxy.http.ValuesFetcher.defaultMetricsConsumerId; import static ai.vespa.metricsproxy.metric.model.ServiceId.toServiceId; import static ai.vespa.metricsproxy.metric.model.json.YamasJsonUtil.YAMAS_ROUTING; import static ai.vespa.metricsproxy.metric.model.json.YamasJsonUtil.toMetricsPackets; @@ -60,18 +60,18 @@ public class YamasJsonUtilTest { @Test public void default_public_consumer_is_filtered_from_yamas_routing() { MetricsPacket packet = new MetricsPacket.Builder(toServiceId("foo")) - .addConsumers(Set.of(VESPA_CONSUMER_ID, DEFAULT_PUBLIC_CONSUMER_ID)) + .addConsumers(Set.of(vespaMetricsConsumerId, defaultMetricsConsumerId)) .build(); YamasJsonModel jsonModel = YamasJsonUtil.toYamasArray(singleton(packet)).metrics.get(0); List<String> namespaces = jsonModel.routing.get(YAMAS_ROUTING).namespaces; assertEquals(1, namespaces.size()); - assertEquals(VESPA_CONSUMER_ID.id, namespaces.get(0)); + assertEquals(vespaMetricsConsumerId.id, namespaces.get(0)); } @Test public void only_default_public_consumer_yields_null_routing_in_json_model() { MetricsPacket packet = new MetricsPacket.Builder(toServiceId("foo")) - .addConsumers(Set.of(DEFAULT_PUBLIC_CONSUMER_ID)) + .addConsumers(Set.of(defaultMetricsConsumerId)) .build(); YamasJsonModel jsonModel = YamasJsonUtil.toYamasArray(singleton(packet)).metrics.get(0); assertNull(jsonModel.routing); diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/rpc/IntegrationTester.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/rpc/IntegrationTester.java index 7275cb737c4..9dcf2d9c375 100644 --- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/rpc/IntegrationTester.java +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/rpc/IntegrationTester.java @@ -22,7 +22,7 @@ import ai.vespa.metricsproxy.service.VespaServicesConfig.Service; import java.io.IOException; -import static ai.vespa.metricsproxy.core.VespaMetrics.VESPA_CONSUMER_ID; +import static ai.vespa.metricsproxy.core.VespaMetrics.vespaMetricsConsumerId; import static ai.vespa.metricsproxy.metric.model.ConsumerId.toConsumerId; import static ai.vespa.metricsproxy.metric.model.ServiceId.toServiceId; import static ai.vespa.metricsproxy.service.HttpMetricFetcher.STATE_PATH; @@ -88,7 +88,7 @@ public class IntegrationTester implements AutoCloseable { private ConsumersConfig consumersConfig() { return new ConsumersConfig.Builder() - .consumer(createConsumer(VESPA_CONSUMER_ID, "foo.count", "foo_count")) + .consumer(createConsumer(vespaMetricsConsumerId, "foo.count", "foo_count")) .consumer(createConsumer(CUSTOM_CONSUMER_ID, "foo.count", "foo.count")) .build(); } diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/rpc/RpcMetricsTest.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/rpc/RpcMetricsTest.java index a363247ff52..8d5bba77844 100644 --- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/rpc/RpcMetricsTest.java +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/rpc/RpcMetricsTest.java @@ -19,7 +19,7 @@ import org.junit.Test; import java.util.List; import static ai.vespa.metricsproxy.TestUtil.getFileContents; -import static ai.vespa.metricsproxy.core.VespaMetrics.VESPA_CONSUMER_ID; +import static ai.vespa.metricsproxy.core.VespaMetrics.vespaMetricsConsumerId; import static ai.vespa.metricsproxy.metric.model.DimensionId.toDimensionId; import static ai.vespa.metricsproxy.rpc.IntegrationTester.CUSTOM_CONSUMER_ID; import static ai.vespa.metricsproxy.rpc.IntegrationTester.MONITORING_SYSTEM; @@ -144,7 +144,7 @@ public class RpcMetricsTest { assertThat(jsonObject.getJSONObject("routing").getJSONObject("yamas").getJSONArray("namespaces").length(), is(1)); if (jsonObject.getJSONObject("metrics").has("foo_count")) { assertThat(jsonObject.getJSONObject("metrics").getInt("foo_count"), is(1)); - assertThat(jsonObject.getJSONObject("routing").getJSONObject("yamas").getJSONArray("namespaces").get(0), is(VESPA_CONSUMER_ID.id)); + assertThat(jsonObject.getJSONObject("routing").getJSONObject("yamas").getJSONArray("namespaces").get(0), is(vespaMetricsConsumerId.id)); } else { assertThat(jsonObject.getJSONObject("metrics").getInt("foo.count"), is(1)); assertThat(jsonObject.getJSONObject("routing").getJSONObject("yamas").getJSONArray("namespaces").get(0), is(CUSTOM_CONSUMER_ID.id)); @@ -190,7 +190,7 @@ public class RpcMetricsTest { assertNotNull("Did not find expected metric with name 'bar'", m2); try (RpcClient rpcClient = new RpcClient(tester.rpcPort())) { - String response = getAllMetricNamesForService(services.get(0).getMonitoringName(), VESPA_CONSUMER_ID, rpcClient); + String response = getAllMetricNamesForService(services.get(0).getMonitoringName(), vespaMetricsConsumerId, rpcClient); assertThat(response, is("foo.count=ON;output-name=foo_count,bar.count=OFF,")); } } |