change metric save interval
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
This commit is contained in:
parent
05d0aa500c
commit
6cea5a1f29
@ -25,12 +25,7 @@ public class MetricService {
|
|||||||
/**
|
/**
|
||||||
* The interval in which the metrics are saved.
|
* The interval in which the metrics are saved.
|
||||||
*/
|
*/
|
||||||
private final long saveInterval = TimeUnit.MINUTES.toMillis(1);
|
private final long saveInterval = TimeUnit.SECONDS.toMillis(15);
|
||||||
|
|
||||||
/**
|
|
||||||
* The interval in which the metrics are written to InfluxDB.
|
|
||||||
*/
|
|
||||||
private final long writeInfluxInterval = TimeUnit.SECONDS.toMillis(30);
|
|
||||||
|
|
||||||
private final WriteApiBlocking influxWriteApi;
|
private final WriteApiBlocking influxWriteApi;
|
||||||
private final MetricsRepository metricsRepository;
|
private final MetricsRepository metricsRepository;
|
||||||
@ -49,8 +44,10 @@ public class MetricService {
|
|||||||
// Load the metrics from Redis
|
// Load the metrics from Redis
|
||||||
loadMetrics();
|
loadMetrics();
|
||||||
|
|
||||||
Timer.scheduleRepeating(this::saveMetrics, saveInterval, saveInterval);
|
Timer.scheduleRepeating(() -> {
|
||||||
Timer.scheduleRepeating(this::writeToInflux, writeInfluxInterval, writeInfluxInterval);
|
saveMetrics();
|
||||||
|
writeToInflux();
|
||||||
|
}, saveInterval, saveInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user