-
Bug
-
Resolution: Fixed
-
Critical
-
None
If time is not specified explicitly for point - current time in millis is used. So if several points having the same measurement name are generated one right after another - they will have same time field. And InfluxDB will save only last of them
The current workaround with sleep between generating points looks too slow for cases with a big number of points.
I suggest next fix. Time should be defaulted for every point built by abstract generator class with value of
builder.time(timeGenerator.getTimeNanos(), TimeUnit.NANOSECONDS);
where timeGenerator is a member of generator having class :
// generates unique nano timestamps
private static class TimeGenerator {
private final long nanoTimeShift;
private long lastReportedTime = 0;
TimeGenerator() {
nanoTimeShift = System.currentTimeMillis() * 1000000 - System.nanoTime();
}
long getTimeNanos() {
long timeToReport = System.nanoTime() + nanoTimeShift;
if (timeToReport <= lastReportedTime) {
timeToReport = lastReportedTime + 1;
}
lastReportedTime = timeToReport;
return timeToReport;
}
}
Code changed in jenkins
User: Eugene Schava
Path:
src/main/java/jenkinsci/plugins/influxdb/generators/PerfPublisherPointGenerator.java
http://jenkins-ci.org/commit/influxdb-plugin/c49391bb12e26240d1a4b4f77945382b8bff00fd
Log:
temp fix for
JENKINS-48110InfluxDB points having same time are ignored if time is not specified explicitly