aboutsummaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-11-05 21:33:35 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2021-11-05 21:33:35 +0100
commit9d457269ebf4725ee1522424e3fe934706511d60 (patch)
tree4137c7f32d87e8eff27bd86b047206114a6a1e83 /configserver
parent4209b3311f43cc5eb0d170a732dc861e3810e036 (diff)
GC old metrics logging to file
Diffstat (limited to 'configserver')
-rw-r--r--configserver/pom.xml6
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/monitoring/Metrics.java26
2 files changed, 5 insertions, 27 deletions
diff --git a/configserver/pom.xml b/configserver/pom.xml
index 5e97e9045a0..aadcac210cb 100644
--- a/configserver/pom.xml
+++ b/configserver/pom.xml
@@ -185,12 +185,6 @@
</dependency>
<dependency>
<groupId>com.yahoo.vespa</groupId>
- <artifactId>statistics</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
<artifactId>configdefinitions</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/monitoring/Metrics.java b/configserver/src/main/java/com/yahoo/vespa/config/server/monitoring/Metrics.java
index b8c5009028f..dc9e727c9e1 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/monitoring/Metrics.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/monitoring/Metrics.java
@@ -15,8 +15,6 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.logging.Level;
-import com.yahoo.statistics.Statistics;
-import com.yahoo.statistics.Counter;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
@@ -25,7 +23,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
- * Metrics for config server. The statistics framework takes care of logging.
+ * Metrics for config server.
*
* @author Harald Musum
*/
@@ -37,9 +35,6 @@ public class Metrics extends AbstractComponent implements MetricUpdaterFactory,
private static final String METRIC_FREE_MEMORY = getMetricName("freeMemory");
private static final String METRIC_LATENCY = getMetricName("latency");
- private final Counter requests;
- private final Counter failedRequests;
- private final Counter procTimeCounter;
private final Metric metric;
private final Optional<ZKMetricUpdater> zkMetricUpdater;
@@ -48,16 +43,13 @@ public class Metrics extends AbstractComponent implements MetricUpdaterFactory,
private final Optional<ScheduledExecutorService> executorService;
@Inject
- public Metrics(Metric metric, Statistics statistics, HealthMonitorConfig healthMonitorConfig, ZookeeperServerConfig zkServerConfig) {
- this(metric, statistics, healthMonitorConfig, zkServerConfig, true);
+ public Metrics(Metric metric, HealthMonitorConfig healthMonitorConfig, ZookeeperServerConfig zkServerConfig) {
+ this(metric, healthMonitorConfig, zkServerConfig, true);
}
- private Metrics(Metric metric, Statistics statistics, HealthMonitorConfig healthMonitorConfig,
+ private Metrics(Metric metric, HealthMonitorConfig healthMonitorConfig,
ZookeeperServerConfig zkServerConfig, boolean createZkMetricUpdater) {
this.metric = metric;
- requests = createCounter(METRIC_REQUESTS, statistics);
- failedRequests = createCounter(METRIC_FAILED_REQUESTS, statistics);
- procTimeCounter = createCounter("procTime", statistics);
if (createZkMetricUpdater) {
log.log(Level.FINE, () -> "Metric update interval is " + healthMonitorConfig.snapshot_interval() + " seconds");
@@ -73,29 +65,21 @@ public class Metrics extends AbstractComponent implements MetricUpdaterFactory,
public static Metrics createTestMetrics() {
NullMetric metric = new NullMetric();
- Statistics.NullImplementation statistics = new Statistics.NullImplementation();
HealthMonitorConfig.Builder builder = new HealthMonitorConfig.Builder();
builder.snapshot_interval(60.0);
ZookeeperServerConfig.Builder zkBuilder = new ZookeeperServerConfig.Builder().myid(1);
- return new Metrics(metric, statistics, new HealthMonitorConfig(builder), new ZookeeperServerConfig(zkBuilder), false);
- }
-
- private Counter createCounter(String name, Statistics statistics) {
- return new Counter(name, statistics, false);
+ return new Metrics(metric, new HealthMonitorConfig(builder), new ZookeeperServerConfig(zkBuilder), false);
}
void incrementRequests(Metric.Context metricContext) {
- requests.increment(1);
metric.add(METRIC_REQUESTS, 1, metricContext);
}
void incrementFailedRequests(Metric.Context metricContext) {
- failedRequests.increment(1);
metric.add(METRIC_FAILED_REQUESTS, 1, metricContext);
}
void incrementProcTime(long increment, Metric.Context metricContext) {
- procTimeCounter.increment(increment);
metric.set(METRIC_LATENCY, increment, metricContext);
}