Go from millisec. to sec. precision in influx timestamps.

Do not go to minNumberOfSamples at first processing.
This commit is contained in:
Mark Nellemann 2022-12-07 16:33:56 +01:00
parent fb5bfd532b
commit 1b5a91c776
2 changed files with 4 additions and 4 deletions

View file

@ -117,7 +117,7 @@ public final class InfluxClient {
measurements.forEach( (m) -> {
Point.Builder builder = Point.measurement(name)
.time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS)
.time(timestamp.getEpochSecond(), TimeUnit.SECONDS)
.tag(m.tags)
.fields(m.fields);
@ -133,7 +133,7 @@ public final class InfluxClient {
measurements.forEach( (m) -> {
log.trace("processMeasurementMap() - timestamp: {}, tags: {}, fields: {}", m.timestamp, m.tags, m.fields);
Point.Builder builder = Point.measurement(name)
.time(m.timestamp.toEpochMilli(), TimeUnit.MILLISECONDS)
.time(m.timestamp.getEpochSecond(), TimeUnit.SECONDS)
.tag(m.tags)
.fields(m.fields);
listOfPoints.add(builder.build());

View file

@ -124,9 +124,9 @@ public abstract class Resource {
sampleHistory.remove(0);
}
// Decrease until we reach minSamples
// Decrease down to minSamples
if(noOfSamples > minNumberOfSamples) {
noOfSamples = Math.min( (noOfSamples - 1), Math.max( (noOfSamples - processed), minNumberOfSamples));
noOfSamples = Math.min( (noOfSamples - 1), Math.max( (noOfSamples - processed) + 5, minNumberOfSamples));
}
}