summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorgjoranv <gv@yahooinc.com>2023-06-21 17:43:15 +0200
committergjoranv <gv@yahooinc.com>2023-06-21 17:43:39 +0200
commit2cc3cac24666d2b6e6f759edf763b6b72b2ea300 (patch)
tree8de7dadbfeb2aa7a33013bd31ff7ab59af831728 /container-search
parent52031bb99e6b0f52d3e1a6142060ef44af3606bb (diff)
Replace metrics strings with the corresponding enum constants.
- Add 'metrics' as provided dep for clustercontroller-core
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java3
-rw-r--r--container-search/src/main/java/com/yahoo/search/searchers/ContainerLatencySearcher.java3
-rwxr-xr-xcontainer-search/src/main/java/com/yahoo/search/searchers/RateLimitingSearcher.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/searchers/test/RateLimitingBenchmark.java3
4 files changed, 8 insertions, 4 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java
index c9e125ab55f..ecce5ddd740 100644
--- a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java
+++ b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.handler;
+import ai.vespa.metrics.ContainerMetrics;
import ai.vespa.cloud.ZoneInfo;
import ai.vespa.metrics.ContainerMetrics;
import com.yahoo.collections.Tuple2;
@@ -81,7 +82,7 @@ public class SearchHandler extends LoggingRequestHandler {
private static final CompoundName FORCE_TIMESTAMPS = CompoundName.from("trace.timestamps");
/** Event name for number of connections to the search subsystem */
- private static final String SEARCH_CONNECTIONS = "search_connections";
+ private static final String SEARCH_CONNECTIONS = ContainerMetrics.SEARCH_CONNECTIONS.baseName();
static final String RENDER_LATENCY_METRIC = ContainerMetrics.JDISC_RENDER_LATENCY.baseName();
static final String MIME_DIMENSION = "mime";
static final String RENDERER_DIMENSION = "renderer";
diff --git a/container-search/src/main/java/com/yahoo/search/searchers/ContainerLatencySearcher.java b/container-search/src/main/java/com/yahoo/search/searchers/ContainerLatencySearcher.java
index 742f4b0f889..f510d68d32e 100644
--- a/container-search/src/main/java/com/yahoo/search/searchers/ContainerLatencySearcher.java
+++ b/container-search/src/main/java/com/yahoo/search/searchers/ContainerLatencySearcher.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.searchers;
+import ai.vespa.metrics.ContainerMetrics;
import com.yahoo.component.chain.dependencies.After;
import com.yahoo.metrics.simple.Gauge;
import com.yahoo.metrics.simple.Point;
@@ -21,7 +22,7 @@ public class ContainerLatencySearcher extends Searcher {
private final Gauge latencyGauge;
public ContainerLatencySearcher(MetricReceiver metrics) {
- latencyGauge = metrics.declareGauge("query_container_latency");
+ latencyGauge = metrics.declareGauge(ContainerMetrics.QUERY_CONTAINER_LATENCY.baseName());
}
@Override
diff --git a/container-search/src/main/java/com/yahoo/search/searchers/RateLimitingSearcher.java b/container-search/src/main/java/com/yahoo/search/searchers/RateLimitingSearcher.java
index 35a3c86f763..846b8881cef 100755
--- a/container-search/src/main/java/com/yahoo/search/searchers/RateLimitingSearcher.java
+++ b/container-search/src/main/java/com/yahoo/search/searchers/RateLimitingSearcher.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.searchers;
+import ai.vespa.metrics.ContainerMetrics;
import com.yahoo.component.annotation.Inject;
import com.yahoo.cloud.config.ClusterInfoConfig;
@@ -60,7 +61,7 @@ public class RateLimitingSearcher extends Searcher {
public static final CompoundName idDimensionKey = CompoundName.from("rate.idDimension");
public static final CompoundName dryRunKey = CompoundName.from("rate.dryRun");
- private static final String requestsOverQuotaMetricName = "requestsOverQuota";
+ private static final String requestsOverQuotaMetricName = ContainerMetrics.REQUESTS_OVER_QUOTA.baseName();
/** Used to divide quota by nodes. Assumption: All nodes get the same share of traffic. */
private final int nodeCount;
diff --git a/container-search/src/test/java/com/yahoo/search/searchers/test/RateLimitingBenchmark.java b/container-search/src/test/java/com/yahoo/search/searchers/test/RateLimitingBenchmark.java
index 5537528d36b..76da6407166 100644
--- a/container-search/src/test/java/com/yahoo/search/searchers/test/RateLimitingBenchmark.java
+++ b/container-search/src/test/java/com/yahoo/search/searchers/test/RateLimitingBenchmark.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.searchers.test;
+import ai.vespa.metrics.ContainerMetrics;
import com.yahoo.cloud.config.ClusterInfoConfig;
import com.yahoo.component.chain.Chain;
import com.yahoo.metrics.simple.Bucket;
@@ -114,7 +115,7 @@ public class RateLimitingBenchmark {
private int rejectedRequests(int id) {
Point context = metric.pointBuilder().set("id", toClientId(id)).build();
- UntypedMetric rejectedRequestsMetric = metricSnapshot.getMapForMetric("requestsOverQuota").get(context);
+ UntypedMetric rejectedRequestsMetric = metricSnapshot.getMapForMetric(ContainerMetrics.REQUESTS_OVER_QUOTA.baseName()).get(context);
if (rejectedRequestsMetric == null) return 0;
return (int)rejectedRequestsMetric.getCount();
}