diff options
author | gjoranv <gv@yahooinc.com> | 2023-06-21 17:43:15 +0200 |
---|---|---|
committer | gjoranv <gv@yahooinc.com> | 2023-06-21 17:43:39 +0200 |
commit | 2cc3cac24666d2b6e6f759edf763b6b72b2ea300 (patch) | |
tree | 8de7dadbfeb2aa7a33013bd31ff7ab59af831728 /clustercontroller-core | |
parent | 52031bb99e6b0f52d3e1a6142060ef44af3606bb (diff) |
Replace metrics strings with the corresponding enum constants.
- Add 'metrics' as provided dep for clustercontroller-core
Diffstat (limited to 'clustercontroller-core')
3 files changed, 12 insertions, 4 deletions
diff --git a/clustercontroller-core/pom.xml b/clustercontroller-core/pom.xml index 647d8ca4e64..e9d83cee7fc 100644 --- a/clustercontroller-core/pom.xml +++ b/clustercontroller-core/pom.xml @@ -20,6 +20,12 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>com.yahoo.vespa</groupId> + <artifactId>metrics</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> <!-- required for bundle-plugin to generate import-package statements for Java's standard library --> <groupId>com.yahoo.vespa</groupId> <artifactId>jdisc_core</artifactId> diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeChecker.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeChecker.java index c823c94afd1..60671c96474 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeChecker.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeChecker.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.vespa.clustercontroller.core; +import ai.vespa.metrics.StorageMetrics; import com.yahoo.lang.MutableBoolean; import com.yahoo.lang.SettableOptional; import com.yahoo.vdslib.distribution.ConfiguredNode; @@ -44,7 +45,7 @@ import static java.util.logging.Level.FINE; public class NodeStateChangeChecker { private static final Logger log = Logger.getLogger(NodeStateChangeChecker.class.getName()); - private static final String BUCKETS_METRIC_NAME = "vds.datastored.bucket_space.buckets_total"; + private static final String BUCKETS_METRIC_NAME = StorageMetrics.VDS_DATASTORED_BUCKET_SPACE_BUCKETS_TOTAL.baseName(); private static final Map<String, String> BUCKETS_METRIC_DIMENSIONS = Map.of("bucketSpace", "default"); private final int requiredRedundancy; diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/NodeStateRequest.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/NodeStateRequest.java index 65c08e67850..09aac786b2f 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/NodeStateRequest.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/NodeStateRequest.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.vespa.clustercontroller.core.restapiv2.requests; +import ai.vespa.metrics.StorageMetrics; import com.yahoo.vespa.clustercontroller.core.NodeInfo; import com.yahoo.vespa.clustercontroller.core.RemoteClusterControllerTask; import com.yahoo.vespa.clustercontroller.core.hostinfo.Metrics; @@ -46,17 +47,17 @@ public class NodeStateRequest extends Request<Response.NodeResponse> { } private static void fillInMetricValue(String name, Metrics.Value value, Response.NodeResponse result) { - if (name.equals("vds.datastored.alldisks.docs")) { + if (name.equals(StorageMetrics.VDS_DATASTORED_ALLDISKS_DOCS.baseName())) { if (value.getLast() == null) { return; } result.addMetric("unique-document-count", value.getLast()); - } else if (name.equals("vds.datastored.alldisks.bytes")) { + } else if (name.equals(StorageMetrics.VDS_DATASTORED_ALLDISKS_BYTES.baseName())) { if (value.getLast() == null) { return; } result.addMetric("unique-document-total-size", value.getLast()); - } else if (name.equals("vds.datastored.alldisks.buckets")) { + } else if (name.equals(StorageMetrics.VDS_DATASTORED_ALLDISKS_BUCKETS.baseName())) { if (value.getLast() == null) { return; } |