Skip to content

Commit

Permalink
Add debug output for influx data-points
Browse files Browse the repository at this point in the history
  • Loading branch information
hibo98 committed Dec 30, 2024
1 parent 9a8575b commit 02f5a69
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/de/freifunkdresden/viewerbackend/Influx.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
package de.freifunkdresden.viewerbackend;

import de.freifunkdresden.viewerbackend.exception.DatabaseConnectionException;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBFactory;
import org.influxdb.dto.BatchPoints;
Expand All @@ -34,6 +37,8 @@

public class Influx {

private static final Logger LOGGER = LogManager.getLogger(Influx.class);

private final String url;
private final String username;
private final String password;
Expand Down Expand Up @@ -68,6 +73,9 @@ public void checkConnection() {
}

public void write(Point p) {
if (DataGen.isDebug()) {
LOGGER.log(Level.DEBUG, "[Influx] Write Point: {}", p);
}
if (DataGen.isReadOnly()) {
return;
}
Expand All @@ -76,6 +84,11 @@ public void write(Point p) {
}

public void write(Collection<Point> points) {
if (DataGen.isDebug()) {
for (Point p : points) {
LOGGER.log(Level.DEBUG, "[Influx] Write Multi-Point: {}", p);
}
}
if (DataGen.isReadOnly()) {
return;
}
Expand Down

0 comments on commit 02f5a69

Please sign in to comment.