Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-48110

InfluxDB points having same time are ignored if time is not specified explicitly

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • influxdb-plugin
    • 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;
      }
      }

       

       

          [JENKINS-48110] InfluxDB points having same time are ignored if time is not specified explicitly

          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-48110 InfluxDB points having same time are ignored if time is not specified explicitly

          SCM/JIRA link daemon added a comment - 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-48110 InfluxDB points having same time are ignored if time is not specified explicitly

          Code changed in jenkins
          User: Eugene Schava
          Path:
          src/main/java/jenkinsci/plugins/influxdb/generators/PerfPublisherPointGenerator.java
          http://jenkins-ci.org/commit/influxdb-plugin/052830c32b85cbf5f4fedfc736ddb6bf3ec13b43
          Log:
          temp fix for JENKINS-48110 InfluxDB points having same time are ignored if time is not specified explicitly

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Eugene Schava Path: src/main/java/jenkinsci/plugins/influxdb/generators/PerfPublisherPointGenerator.java http://jenkins-ci.org/commit/influxdb-plugin/052830c32b85cbf5f4fedfc736ddb6bf3ec13b43 Log: temp fix for JENKINS-48110 InfluxDB points having same time are ignored if time is not specified explicitly

          Aleksi Simell added a comment -

          Aleksi Simell added a comment - Do  https://github.com/jenkinsci/influxdb-plugin/pull/42  and https://github.com/jenkinsci/influxdb-plugin/pull/48  address this issue sufficiently? 

          Eugene Schava added a comment -

          I think yes. At least they use time generator that generates unique values always

          Eugene Schava added a comment - I think yes. At least they use time generator that generates unique values always

          Aleksi Simell added a comment -

          I will then close this bug as fixed. If problem persists, please re-open the ticket.

          Aleksi Simell added a comment - I will then close this bug as fixed. If problem persists, please re-open the ticket.

          Aleksi Simell added a comment -

          Fixed by previous pull requests.

          Aleksi Simell added a comment - Fixed by previous pull requests.

            aleksisimell Aleksi Simell
            eschava Eugene Schava
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: