summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--container-disc/src/main/java/com/yahoo/container/jdisc/metric/MetricConsumerProviderProvider.java1
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/application/MetricConsumer.java31
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java9
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Instrumented.java5
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Metric.java46
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsResponse.java12
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/NodeMetricsDb.java47
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Resource.java16
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java7
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java4
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/NodeMetricsDbTest.java8
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java3
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java3
-rw-r--r--simplemetrics/src/main/java/com/yahoo/metrics/simple/Measurement.java4
-rw-r--r--simplemetrics/src/main/java/com/yahoo/metrics/simple/Sample.java3
-rw-r--r--simplemetrics/src/main/java/com/yahoo/metrics/simple/jdisc/JdiscMetricsFactory.java2
16 files changed, 122 insertions, 79 deletions
diff --git a/container-disc/src/main/java/com/yahoo/container/jdisc/metric/MetricConsumerProviderProvider.java b/container-disc/src/main/java/com/yahoo/container/jdisc/metric/MetricConsumerProviderProvider.java
index a3f8819f843..a44650a153d 100644
--- a/container-disc/src/main/java/com/yahoo/container/jdisc/metric/MetricConsumerProviderProvider.java
+++ b/container-disc/src/main/java/com/yahoo/container/jdisc/metric/MetricConsumerProviderProvider.java
@@ -15,7 +15,6 @@ import com.yahoo.metrics.MetricsPresentationConfig;
*
* @author bratseth
*/
-@SuppressWarnings("unused") // Injected
public class MetricConsumerProviderProvider implements Provider<MetricConsumerProvider> {
private final MetricConsumerProvider provided;
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/application/MetricConsumer.java b/jdisc_core/src/main/java/com/yahoo/jdisc/application/MetricConsumer.java
index f060f1840ff..44cfb205271 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/application/MetricConsumer.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/application/MetricConsumer.java
@@ -39,30 +39,31 @@ import java.util.Map;
public interface MetricConsumer {
/**
- * <p>Consume a call to <code>Metric.set(String, Number, Metric.Context)</code>.</p>
+ * Consume a call to <code>Metric.set(String, Number, Metric.Context)</code>.
*
- * @param key The name of the metric to modify.
- * @param val The value to assign to the named metric.
- * @param ctx The context to further describe this entry.
+ * @param key the name of the metric to modify
+ * @param val the value to assign to the named metric
+ * @param ctx the context to further describe this entry
*/
- public void set(String key, Number val, Metric.Context ctx);
+ void set(String key, Number val, Metric.Context ctx);
/**
- * <p>Consume a call to <code>Metric.add(String, Number, Metric.Context)</code>.</p>
+ * Consume a call to <code>Metric.add(String, Number, Metric.Context)</code>.
*
- * @param key The name of the metric to modify.
- * @param val The value to add to the named metric.
- * @param ctx The context to further describe this entry.
+ * @param key the name of the metric to modify
+ * @param val the value to add to the named metric
+ * @param ctx the context to further describe this entry
*/
- public void add(String key, Number val, Metric.Context ctx);
+ void add(String key, Number val, Metric.Context ctx);
/**
- * <p>Creates a <code>Metric.Context</code> object that encapsulates the given properties. The returned Context object
+ * Creates a <code>Metric.Context</code> object that encapsulates the given properties. The returned Context object
* will be passed along every future call to <code>set(String, Number, Metric.Context)</code> and
- * <code>add(String, Number, Metric.Context)</code> where the properties match those given here.</p>
+ * <code>add(String, Number, Metric.Context)</code> where the properties match those given here.
*
- * @param properties The properties to incorporate in the context.
- * @return The created context.
+ * @param properties the properties to incorporate in the context
+ * @return the created context
*/
- public Metric.Context createContext(Map<String, ?> properties);
+ Metric.Context createContext(Map<String, ?> properties);
+
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java
index 152ab4f5ca8..0aa8e8db62b 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java
@@ -12,7 +12,6 @@ import java.time.Duration;
import java.time.Instant;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collector;
import java.util.stream.Collectors;
/**
@@ -103,17 +102,19 @@ public class Autoscaler {
List<Node> clusterNodes) {
ApplicationId application = clusterNodes.get(0).allocation().get().owner();
ClusterSpec.Type clusterType = clusterNodes.get(0).allocation().get().membership().cluster().type();
+
Instant startTime = nodeRepository.clock().instant().minus(scalingWindow(clusterType));
- List<NodeMetricsDb.DeploymentEvent> deployments = metricsDb.getEvents(application);
+ Optional<Long> generation = Optional.empty();
+ List<NodeMetricsDb.AutoscalingEvent> deployments = metricsDb.getEvents(application);
if (! deployments.isEmpty()) {
var deployment = deployments.get(deployments.size() - 1);
if (deployment.time().isAfter(startTime))
- startTime = deployment.time();
+ startTime = deployment.time(); // just to filter more faster
}
List<NodeMetricsDb.NodeMeasurements> measurements = metricsDb.getMeasurements(startTime,
- resource,
+ Metric.from(resource),
clusterNodes.stream().map(Node::hostname).collect(Collectors.toList()));
// Require a total number of measurements scaling with the number of nodes,
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Instrumented.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Instrumented.java
new file mode 100644
index 00000000000..1e1370c86c6
--- /dev/null
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Instrumented.java
@@ -0,0 +1,5 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.provision.autoscale;
+
+public enum Instrumented {
+}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Metric.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Metric.java
new file mode 100644
index 00000000000..b98535f19c3
--- /dev/null
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Metric.java
@@ -0,0 +1,46 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.provision.autoscale;
+
+/**
+ * A kind of measurement we are making for autoscaling purposes
+ *
+ * @author bratseth
+ */
+public enum Metric {
+
+ cpu { // a node resource
+ public String fullName() { return "cpu.util"; }
+ float valueFromMetric(double metricValue) { return (float)metricValue / 100; } // % to ratio
+ },
+ memory { // a node resource
+ public String fullName() { return "mem_total.util"; }
+ float valueFromMetric(double metricValue) { return (float)metricValue / 100; } // % to ratio
+ },
+ disk { // a node resource
+ public String fullName() { return "disk.util"; }
+ float valueFromMetric(double metricValue) { return (float)metricValue / 100; } // % to ratio
+ },
+ generation { // application config generation active on the node
+ public String fullName() { return "application_generation"; }
+ float valueFromMetric(double metricValue) { return (float)metricValue; } // Really an integer, ok up to 16M gens
+ };
+
+ /** The name of this metric as emitted from its source */
+ public abstract String fullName();
+
+ /** Convert from the emitted value of this metric to the value we want to use here */
+ abstract float valueFromMetric(double metricValue);
+
+ public static Metric fromFullName(String name) {
+ for (Metric metric : values())
+ if (metric.fullName().equals(name)) return metric;
+ throw new IllegalArgumentException("Metric '" + name + "' has no mapping");
+ }
+
+ public static Metric from(Resource resource) {
+ for (Metric metric : values())
+ if (metric.name().equals(resource.name())) return metric;
+ throw new IllegalArgumentException("Resource '" + resource + "' does not map to a metric");
+ }
+
+}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsResponse.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsResponse.java
index 87551a5bd5f..b4195b4cdf1 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsResponse.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/MetricsResponse.java
@@ -46,16 +46,16 @@ public class MetricsResponse {
private void consumeNodeMetrics(String hostname, Inspector node) {
long timestampSecond = node.field("timestamp").asLong();
Map<String, Double> values = consumeMetrics(node.field("metrics"));
- for (Resource resource : Resource.values())
- addMetricIfPresent(hostname, resource, timestampSecond, values);
+ for (Metric metric : Metric.values())
+ addMetricIfPresent(hostname, metric, timestampSecond, values);
}
- private void addMetricIfPresent(String hostname, Resource resource, long timestampSecond, Map<String, Double> values) {
- if (values.containsKey(resource.metricName()))
+ private void addMetricIfPresent(String hostname, Metric metric, long timestampSecond, Map<String, Double> values) {
+ if (values.containsKey(metric.fullName()))
metricValues.add(new NodeMetrics.MetricValue(hostname,
- resource.metricName(),
+ metric.fullName(),
timestampSecond,
- values.get(resource.metricName())));
+ values.get(metric.fullName())));
}
private void consumeServiceMetrics(String hostname, Inspector node) {
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/NodeMetricsDb.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/NodeMetricsDb.java
index 74c75c3c0a1..a1a2837be4e 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/NodeMetricsDb.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/NodeMetricsDb.java
@@ -33,7 +33,7 @@ public class NodeMetricsDb {
private final Map<NodeMeasurementsKey, NodeMeasurements> db = new HashMap<>();
/** Events */
- private final List<DeploymentEvent> events = new ArrayList<>();
+ private final List<AutoscalingEvent> events = new ArrayList<>();
/** Lock all access for now since we modify lists inside a map */
private final Object lock = new Object();
@@ -46,27 +46,27 @@ public class NodeMetricsDb {
public void add(Collection<NodeMetrics.MetricValue> metricValues) {
synchronized (lock) {
for (var value : metricValues) {
- Resource resource = Resource.fromMetric(value.name());
- NodeMeasurementsKey key = new NodeMeasurementsKey(value.hostname(), resource);
+ Metric metric = Metric.fromFullName(value.name());
+ NodeMeasurementsKey key = new NodeMeasurementsKey(value.hostname(), metric);
NodeMeasurements measurements = db.get(key);
if (measurements == null) { // new node
Optional<Node> node = nodeRepository.getNode(value.hostname());
if (node.isEmpty()) continue;
if (node.get().allocation().isEmpty()) continue;
measurements = new NodeMeasurements(value.hostname(),
- resource,
+ metric,
node.get().allocation().get().membership().cluster().type(),
new ArrayList<>());
db.put(key, measurements);
}
measurements.add(new Measurement(value.timestampSecond() * 1000,
- (float)resource.valueFromMetric(value.value())));
+ metric.valueFromMetric(value.value())));
}
}
}
/** Adds an event to this */
- public void add(DeploymentEvent event) {
+ public void add(AutoscalingEvent event) {
synchronized (lock) {
events.add(event);
}
@@ -92,11 +92,11 @@ public class NodeMetricsDb {
* Returns a list of measurements with one entry for each of the given host names
* which have any values after startTime, in the same order
*/
- public List<NodeMeasurements> getMeasurements(Instant startTime, Resource resource, List<String> hostnames) {
+ public List<NodeMeasurements> getMeasurements(Instant startTime, Metric metric, List<String> hostnames) {
synchronized (lock) {
List<NodeMeasurements> measurementsList = new ArrayList<>(hostnames.size());
for (String hostname : hostnames) {
- NodeMeasurements measurements = db.get(new NodeMeasurementsKey(hostname, resource));
+ NodeMeasurements measurements = db.get(new NodeMeasurementsKey(hostname, metric));
if (measurements == null) continue;
measurements = measurements.copyAfter(startTime);
if (measurements.isEmpty()) continue;
@@ -106,7 +106,7 @@ public class NodeMetricsDb {
}
}
- public List<DeploymentEvent> getEvents(ApplicationId application) {
+ public List<AutoscalingEvent> getEvents(ApplicationId application) {
synchronized (lock) {
return events.stream().filter(event -> event.application().equals(application)).collect(Collectors.toList());
}
@@ -115,16 +115,16 @@ public class NodeMetricsDb {
private static class NodeMeasurementsKey {
private final String hostname;
- private final Resource resource;
+ private final Metric metric;
- public NodeMeasurementsKey(String hostname, Resource resource) {
+ public NodeMeasurementsKey(String hostname, Metric metric) {
this.hostname = hostname;
- this.resource = resource;
+ this.metric = metric;
}
@Override
public int hashCode() {
- return Objects.hash(hostname, resource);
+ return Objects.hash(hostname, metric);
}
@Override
@@ -133,26 +133,26 @@ public class NodeMetricsDb {
if ( ! (o instanceof NodeMeasurementsKey)) return false;
NodeMeasurementsKey other = (NodeMeasurementsKey)o;
if ( ! this.hostname.equals(other.hostname)) return false;
- if ( ! this.resource.equals(other.resource)) return false;
+ if ( ! this.metric.equals(other.metric)) return false;
return true;
}
@Override
- public String toString() { return "key to measurements of " + resource + " for " + hostname; }
+ public String toString() { return "key to measurements of " + metric + " for " + hostname; }
}
public static class NodeMeasurements {
private final String hostname;
- private final Resource resource;
+ private final Metric metric;
private final ClusterSpec.Type type;
private final List<Measurement> measurements;
// Note: This transfers ownership of the measurement list to this
- private NodeMeasurements(String hostname, Resource resource, ClusterSpec.Type type, List<Measurement> measurements) {
+ private NodeMeasurements(String hostname, Metric metric, ClusterSpec.Type type, List<Measurement> measurements) {
this.hostname = hostname;
- this.resource = resource;
+ this.metric = metric;
this.type = type;
this.measurements = measurements;
}
@@ -169,7 +169,7 @@ public class NodeMetricsDb {
public NodeMeasurements copyAfter(Instant oldestTime) {
long oldestTimestamp = oldestTime.toEpochMilli();
- return new NodeMeasurements(hostname, resource, type,
+ return new NodeMeasurements(hostname, metric, type,
measurements.stream()
.filter(measurement -> measurement.timestamp >= oldestTimestamp)
.collect(Collectors.toList()));
@@ -187,19 +187,20 @@ public class NodeMetricsDb {
}
public static class Measurement {
+
// TODO: Order by timestamp
/** The time of this measurement in epoch millis */
private final long timestamp;
/** The measured value */
- private final float value;
+ private final double value;
public Measurement(long timestamp, float value) {
this.timestamp = timestamp;
this.value = value;
}
- public float value() { return value; }
+ public double value() { return value; }
public Instant at() { return Instant.ofEpochMilli(timestamp); }
@Override
@@ -207,13 +208,13 @@ public class NodeMetricsDb {
}
- public static class DeploymentEvent {
+ public static class AutoscalingEvent {
private final ApplicationId application;
private final long generation;
private final long timestamp;
- public DeploymentEvent(ApplicationId application, long generation, Instant times) {
+ public AutoscalingEvent(ApplicationId application, long generation, Instant times) {
this.application = application;
this.generation = generation;
this.timestamp = times.toEpochMilli();
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Resource.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Resource.java
index 3d5ce8881e0..7f1844efdbe 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Resource.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Resource.java
@@ -12,41 +12,31 @@ public enum Resource {
/** Cpu utilization ratio */
cpu {
- public String metricName() { return "cpu.util"; }
double idealAverageLoad() { return 0.2; }
double valueFrom(NodeResources resources) { return resources.vcpu(); }
- double valueFromMetric(double metricValue) { return metricValue / 100; } // % to ratio
},
/** Memory utilization ratio */
memory {
- public String metricName() { return "mem_total.util"; }
double idealAverageLoad() { return 0.7; }
double valueFrom(NodeResources resources) { return resources.memoryGb(); }
- double valueFromMetric(double metricValue) { return metricValue / 100; } // % to ratio
},
/** Disk utilization ratio */
disk {
- public String metricName() { return "disk.util"; }
double idealAverageLoad() { return 0.6; }
double valueFrom(NodeResources resources) { return resources.diskGb(); }
- double valueFromMetric(double metricValue) { return metricValue / 100; } // % to ratio
};
- public abstract String metricName();
-
/** The load we should have of this resource on average, when one node in the cluster is down */
abstract double idealAverageLoad();
abstract double valueFrom(NodeResources resources);
- abstract double valueFromMetric(double metricValue);
-
- public static Resource fromMetric(String metricName) {
+ public static Resource from(Metric metric) {
for (Resource resource : values())
- if (resource.metricName().equals(metricName)) return resource;
- throw new IllegalArgumentException("Metric '" + metricName + "' does not map to a resource");
+ if (resource.name().equals(metric.name())) return resource;
+ throw new IllegalArgumentException("Metric '" + metric + "' does not map to a resource");
}
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
index 4f811f9198f..7cd3575b9a6 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
@@ -5,7 +5,6 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ClusterResources;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.Deployer;
-import com.yahoo.config.provision.NodeResources;
import com.yahoo.jdisc.Metric;
import com.yahoo.vespa.hosted.provision.Node;
import com.yahoo.vespa.hosted.provision.NodeRepository;
@@ -76,9 +75,9 @@ public class AutoscalingMaintainer extends NodeRepositoryMaintainer {
logAutoscaling(target.get(), applicationId, clusterId, clusterNodes);
Optional<Long> resultingGeneration = deployment.activate();
if (resultingGeneration.isEmpty()) return; // Failed to activate
- metricsDb.add(new NodeMetricsDb.DeploymentEvent(applicationId,
- resultingGeneration.get(),
- nodeRepository().clock().instant()));
+ metricsDb.add(new NodeMetricsDb.AutoscalingEvent(applicationId,
+ resultingGeneration.get(),
+ nodeRepository().clock().instant()));
}
}
}
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java
index 0a127eacae1..b988a648632 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java
@@ -133,7 +133,7 @@ class AutoscalingTester {
float effectiveValue = (r == resource ? value : (float) r.idealAverageLoad() * otherResourcesLoad)
* oneExtraNodeFactor;
db.add(List.of(new NodeMetrics.MetricValue(node.hostname(),
- r.metricName(),
+ Metric.from(r).fullName(),
clock().instant().toEpochMilli(),
effectiveValue * 100))); // the metrics are in %
}
@@ -147,7 +147,7 @@ class AutoscalingTester {
clock().advance(Duration.ofMinutes(1));
for (Node node : nodes) {
db.add(List.of(new NodeMetrics.MetricValue(node.hostname(),
- resource.metricName(),
+ Metric.from(resource).fullName(),
clock().instant().toEpochMilli(),
value * 100))); // the metrics are in %
}
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/NodeMetricsDbTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/NodeMetricsDbTest.java
index 753a26ea452..6b4e4a1f743 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/NodeMetricsDbTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/NodeMetricsDbTest.java
@@ -42,11 +42,11 @@ public class NodeMetricsDbTest {
// Avoid off-by-one bug when the below windows starts exactly on one of the above getEpochSecond() timestamps.
clock.advance(Duration.ofMinutes(1));
- assertEquals(35, measurementCount(db.getMeasurements(clock.instant().minus(Duration.ofHours(6)), Resource.cpu, List.of(node0))));
- assertEquals( 0, measurementCount(db.getMeasurements(clock.instant().minus(Duration.ofHours(6)), Resource.memory, List.of(node0))));
+ assertEquals(35, measurementCount(db.getMeasurements(clock.instant().minus(Duration.ofHours(6)), Metric.cpu, List.of(node0))));
+ assertEquals( 0, measurementCount(db.getMeasurements(clock.instant().minus(Duration.ofHours(6)), Metric.memory, List.of(node0))));
db.gc(clock);
- assertEquals( 5, measurementCount(db.getMeasurements(clock.instant().minus(Duration.ofHours(6)), Resource.cpu, List.of(node0))));
- assertEquals( 0, measurementCount(db.getMeasurements(clock.instant().minus(Duration.ofHours(6)), Resource.memory, List.of(node0))));
+ assertEquals( 5, measurementCount(db.getMeasurements(clock.instant().minus(Duration.ofHours(6)), Metric.cpu, List.of(node0))));
+ assertEquals( 0, measurementCount(db.getMeasurements(clock.instant().minus(Duration.ofHours(6)), Metric.memory, List.of(node0))));
}
private int measurementCount(List<NodeMetricsDb.NodeMeasurements> measurements) {
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java
index 88195cf0ed9..239e0720574 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java
@@ -14,6 +14,7 @@ import com.yahoo.config.provision.Zone;
import com.yahoo.config.provisioning.FlavorsConfig;
import com.yahoo.vespa.hosted.provision.Node;
import com.yahoo.vespa.hosted.provision.NodeRepository;
+import com.yahoo.vespa.hosted.provision.autoscale.Metric;
import com.yahoo.vespa.hosted.provision.autoscale.NodeMetrics;
import com.yahoo.vespa.hosted.provision.autoscale.NodeMetricsDb;
import com.yahoo.vespa.hosted.provision.autoscale.Resource;
@@ -96,7 +97,7 @@ public class AutoscalingMaintainerTest {
for (int i = 0; i < count; i++) {
for (Node node : nodes)
db.add(List.of(new NodeMetrics.MetricValue(node.hostname(),
- resource.metricName(),
+ Metric.from(resource).fullName(),
nodeRepository.clock().instant().toEpochMilli(),
value * 100))); // the metrics are in %
}
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java
index 31a9fcb8999..7c34d2cc336 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java
@@ -14,6 +14,7 @@ import com.yahoo.config.provision.Zone;
import com.yahoo.config.provisioning.FlavorsConfig;
import com.yahoo.vespa.hosted.provision.Node;
import com.yahoo.vespa.hosted.provision.NodeRepository;
+import com.yahoo.vespa.hosted.provision.autoscale.Metric;
import com.yahoo.vespa.hosted.provision.autoscale.NodeMetrics;
import com.yahoo.vespa.hosted.provision.autoscale.NodeMetricsDb;
import com.yahoo.vespa.hosted.provision.autoscale.Resource;
@@ -81,7 +82,7 @@ public class ScalingSuggestionsMaintainerTest {
for (int i = 0; i < count; i++) {
for (Node node : nodes)
db.add(List.of(new NodeMetrics.MetricValue(node.hostname(),
- resource.metricName(),
+ Metric.from(resource).fullName(),
nodeRepository.clock().instant().toEpochMilli(),
value * 100))); // the metrics are in %
}
diff --git a/simplemetrics/src/main/java/com/yahoo/metrics/simple/Measurement.java b/simplemetrics/src/main/java/com/yahoo/metrics/simple/Measurement.java
index cc7a4b0f717..4098ac1bdea 100644
--- a/simplemetrics/src/main/java/com/yahoo/metrics/simple/Measurement.java
+++ b/simplemetrics/src/main/java/com/yahoo/metrics/simple/Measurement.java
@@ -2,12 +2,12 @@
package com.yahoo.metrics.simple;
/**
- * Wrapper class for the actually measured value. Candidate for removal, but I
- * wanted a type instead of some opaque instance of Number.
+ * Wrapper class for the actually measured value.
*
* @author Steinar Knutsen
*/
public class Measurement {
+
private final Number magnitude;
public Measurement(Number magnitude) {
diff --git a/simplemetrics/src/main/java/com/yahoo/metrics/simple/Sample.java b/simplemetrics/src/main/java/com/yahoo/metrics/simple/Sample.java
index 837e93de09a..0d2144deeb4 100644
--- a/simplemetrics/src/main/java/com/yahoo/metrics/simple/Sample.java
+++ b/simplemetrics/src/main/java/com/yahoo/metrics/simple/Sample.java
@@ -42,8 +42,7 @@ public class Sample {
* Get histogram definition for an arbitrary metric. Caveat emptor: This
* involves reading a volatile.
*
- * @param metricName
- * name of the metric to get histogram definition for
+ * @param metricName name of the metric to get histogram definition for
* @return how to define a new histogram or null
*/
MetricSettings getHistogramDefinition(String metricName) {
diff --git a/simplemetrics/src/main/java/com/yahoo/metrics/simple/jdisc/JdiscMetricsFactory.java b/simplemetrics/src/main/java/com/yahoo/metrics/simple/jdisc/JdiscMetricsFactory.java
index ae84ee95ecc..30102c43919 100644
--- a/simplemetrics/src/main/java/com/yahoo/metrics/simple/jdisc/JdiscMetricsFactory.java
+++ b/simplemetrics/src/main/java/com/yahoo/metrics/simple/jdisc/JdiscMetricsFactory.java
@@ -14,7 +14,7 @@ import com.yahoo.metrics.simple.MetricReceiver;
/**
* A factory for all the JDisc API classes.
*
- * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
+ * @author Steinar Knutsen
*/
public class JdiscMetricsFactory implements MetricConsumerFactory, SnapshotProvider {