fix influx
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m48s
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m48s
This commit is contained in:
parent
13964e0f65
commit
1408cecee3
@ -1,6 +1,5 @@
|
|||||||
package xyz.mcutils.backend.service;
|
package xyz.mcutils.backend.service;
|
||||||
|
|
||||||
import com.influxdb.client.InfluxDBClient;
|
|
||||||
import com.influxdb.client.WriteApiBlocking;
|
import com.influxdb.client.WriteApiBlocking;
|
||||||
import com.influxdb.spring.influx.InfluxDB2AutoConfiguration;
|
import com.influxdb.spring.influx.InfluxDB2AutoConfiguration;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
@ -26,16 +25,14 @@ public class MetricService {
|
|||||||
/**
|
/**
|
||||||
* The interval in which the metrics are saved.
|
* The interval in which the metrics are saved.
|
||||||
*/
|
*/
|
||||||
private final long saveInterval = TimeUnit.SECONDS.toMillis(15);
|
private final long saveInterval = TimeUnit.SECONDS.toMillis(15L);
|
||||||
|
|
||||||
private final WriteApiBlocking influxWriteApi;
|
private final WriteApiBlocking influxWriteApi;
|
||||||
private final MetricsRepository metricsRepository;
|
private final MetricsRepository metricsRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public MetricService(InfluxDB2AutoConfiguration influxAutoConfiguration, MetricsRepository metricsRepository) {
|
public MetricService(InfluxDB2AutoConfiguration influxAutoConfiguration, MetricsRepository metricsRepository) {
|
||||||
try (InfluxDBClient client = influxAutoConfiguration.influxDBClient()) {
|
this.influxWriteApi = influxAutoConfiguration.influxDBClient().getWriteApiBlocking();
|
||||||
this.influxWriteApi = client.getWriteApiBlocking();
|
|
||||||
}
|
|
||||||
this.metricsRepository = metricsRepository;
|
this.metricsRepository = metricsRepository;
|
||||||
|
|
||||||
// Register the metrics
|
// Register the metrics
|
||||||
|
Loading…
Reference in New Issue
Block a user