• Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • influxdb-plugin
    • None
    • Jenkins version: 2.346.1
      InfluxDB Version: 3.3
      Windows Server 2016
      InfluxDB: 2.?

      Hello,

      I am trying to push some customData to influxdb and everything works fine until I try to use an array in my data. To investigate the problem I wrote an small pipeline example with the following code: see attachement PipelineExample.txt

      If I try to push the data to influx I get the response:

      [InfluxDB Plugin] Collecting data...

      http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2[InfluxDB Plugin] Custom data map found. Writing to InfluxDB...

      http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3[InfluxDB Plugin] Failed to collect data. Ignoring Exception:java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')

      http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4[InfluxDB Plugin] Publishing data to target 'InfluxDB' (url='', database='testbucket')

      http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5[InfluxDB Plugin] Completed.

      I seems so that your plugin has a problem to push array data to influx. Why? Is it forbidden? How can I solve my problem?

          [JENKINS-69021] Error sending array to influx

          Christoph Hero created issue -
          Christoph Hero made changes -
          Description Original: Hello,

          I am trying to push some customData to influxdb and everything works fine until I try to use an array in my data. To investigate the problem I wrote an small pipeline example with the following code:
          {quote}import groovy.json.JsonSlurperClassic

          pipeline {
              agent any
              
              environment {
                  JsonCollectorObject = null
                  Test = "Hallo"
              }
              
              stages {
                  stage("ClangTidy") {
                      steps {
                          script {
                              JsonCollectorObject = new net.sf.json.JSONObject()
                              
                              def props = readJSON text: '\{"Failed":  1, "Succeeded":  2, "ProcessedFiles":  3}', returnPojo: false
                              JsonCollectorObject.element("ClangTidy", props)
                          }
                      }
                  }
                  
                  stage("ClangFormat") {
                      steps {
                          script {
                              def props = readJSON text: '\{"Failed":  4, "Succeeded":  5, "ProcessedFiles":  6}', returnPojo: false
                              JsonCollectorObject.element("ClangFormat", props)
                          }
                      }
                  }
                  
                  stage("Array") {
                      steps {
                          script {
                              def props = readJSON text: '[3, 4, 5]', returnPojo: false
                              JsonCollectorObject.element("Array", props)
                          }
                      }
                  }
                  
                  stage("Publish") {
                      steps {
                          script
                          {
                              Test = JsonCollectorObject.toString(3)
                              println(Test)
                              
                              Map dataMap = new JsonSlurperClassic().parseText(JsonCollectorObject.toString())
                              influxDbPublisher(selectedTarget: 'InfluxDB', customDataMap: dataMap)
                          }
                      }
                  }
              
              }
          }
          {quote}
          If I try to push the data to influx I get the response:


          {quote}[InfluxDB Plugin] Collecting data...

          [|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2][InfluxDB Plugin] Custom data map found. Writing to InfluxDB...

          [|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3][InfluxDB Plugin] Failed to collect data. Ignoring Exception:java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')

          [|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4][InfluxDB Plugin] Publishing data to target 'InfluxDB' (url='[https://influxtest.bu5.digital/]', database='testbucket')

          [|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5][InfluxDB Plugin] Completed.{quote}
          I seems so that your plugin has a problem to push array data to influx. Why? Is it forbidden? How can I solve my problem?
          New: Hello,

          I am trying to push some customData to influxdb and everything works fine until I try to use an array in my data. To investigate the problem I wrote an small pipeline example with the following code:
          {quote}import groovy.json.JsonSlurperClassic

          pipeline {
              agent any
              
              environment {
                  JsonCollectorObject = null
                  Test = "Hallo"
              }
              
              stages {
                  stage("ClangTidy") {
                      steps {
                          script {
                              JsonCollectorObject = new net.sf.json.JSONObject()
                              
                              def props = readJSON text: '\{"Failed":  1, "Succeeded":  2, "ProcessedFiles":  3}', returnPojo: false
                              JsonCollectorObject.element("ClangTidy", props)
                          }
                      }
                  }
                  
                  stage("ClangFormat") {
                      steps {
                          script {
                              def props = readJSON text: '\{"Failed":  4, "Succeeded":  5, "ProcessedFiles":  6}', returnPojo: false
                              JsonCollectorObject.element("ClangFormat", props)
                          }
                      }
                  }
                  
                  stage("Array") {
                      steps {
                          script {
                              def props = readJSON text: '[3, 4, 5]', returnPojo: false
                              JsonCollectorObject.element("Array", props)
                          }
                      }
                  }
                  
                  stage("Publish") {
                      steps {
                          script
                          {
                              Test = JsonCollectorObject.toString(3)
                              println(Test)
                              
                              Map dataMap = new JsonSlurperClassic().parseText(JsonCollectorObject.toString())
                              influxDbPublisher(selectedTarget: 'InfluxDB', customDataMap: dataMap)
                          }
                      }
                  }
              
              }
          }
          {quote}
          If I try to push the data to influx I get the response:
          {quote}[InfluxDB Plugin] Collecting data...

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2][InfluxDB Plugin] Custom data map found. Writing to InfluxDB...

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3][InfluxDB Plugin] Failed to collect data. Ignoring Exception:java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4][InfluxDB Plugin] Publishing data to target 'InfluxDB' (url='[---|https://influxtest.bu5.digital/]', database='testbucket')

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5][InfluxDB Plugin] Completed.
          {quote}
          I seems so that your plugin has a problem to push array data to influx. Why? Is it forbidden? How can I solve my problem?
          Christoph Hero made changes -
          Description Original: Hello,

          I am trying to push some customData to influxdb and everything works fine until I try to use an array in my data. To investigate the problem I wrote an small pipeline example with the following code:
          {quote}import groovy.json.JsonSlurperClassic

          pipeline {
              agent any
              
              environment {
                  JsonCollectorObject = null
                  Test = "Hallo"
              }
              
              stages {
                  stage("ClangTidy") {
                      steps {
                          script {
                              JsonCollectorObject = new net.sf.json.JSONObject()
                              
                              def props = readJSON text: '\{"Failed":  1, "Succeeded":  2, "ProcessedFiles":  3}', returnPojo: false
                              JsonCollectorObject.element("ClangTidy", props)
                          }
                      }
                  }
                  
                  stage("ClangFormat") {
                      steps {
                          script {
                              def props = readJSON text: '\{"Failed":  4, "Succeeded":  5, "ProcessedFiles":  6}', returnPojo: false
                              JsonCollectorObject.element("ClangFormat", props)
                          }
                      }
                  }
                  
                  stage("Array") {
                      steps {
                          script {
                              def props = readJSON text: '[3, 4, 5]', returnPojo: false
                              JsonCollectorObject.element("Array", props)
                          }
                      }
                  }
                  
                  stage("Publish") {
                      steps {
                          script
                          {
                              Test = JsonCollectorObject.toString(3)
                              println(Test)
                              
                              Map dataMap = new JsonSlurperClassic().parseText(JsonCollectorObject.toString())
                              influxDbPublisher(selectedTarget: 'InfluxDB', customDataMap: dataMap)
                          }
                      }
                  }
              
              }
          }
          {quote}
          If I try to push the data to influx I get the response:
          {quote}[InfluxDB Plugin] Collecting data...

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2][InfluxDB Plugin] Custom data map found. Writing to InfluxDB...

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3][InfluxDB Plugin] Failed to collect data. Ignoring Exception:java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4][InfluxDB Plugin] Publishing data to target 'InfluxDB' (url='[---|https://influxtest.bu5.digital/]', database='testbucket')

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5][InfluxDB Plugin] Completed.
          {quote}
          I seems so that your plugin has a problem to push array data to influx. Why? Is it forbidden? How can I solve my problem?
          New: Hello,

          I am trying to push some customData to influxdb and everything works fine until I try to use an array in my data. To investigate the problem I wrote an small pipeline example with the following code:
          ----
          import groovy.json.JsonSlurperClassic

          pipeline {
              agent any
              
              environment {
                  JsonCollectorObject = null
                  Test = "Hallo"
              }
              
              stages {
                  stage("ClangTidy") {
                      steps {
                          script {
                              JsonCollectorObject = new net.sf.json.JSONObject()
                              
                              def props = readJSON text: '\{"Failed":  1, "Succeeded":  2, "ProcessedFiles":  3}', returnPojo: false
                              JsonCollectorObject.element("ClangTidy", props)
                          }
                      }
                  }
                  
                  stage("ClangFormat") {
                      steps {
                          script {
                              def props = readJSON text: '\{"Failed":  4, "Succeeded":  5, "ProcessedFiles":  6}', returnPojo: false
                              JsonCollectorObject.element("ClangFormat", props)
                          }
                      }
                  }
                  
                  stage("Array") {
                      steps {
                          script {
                              def props = readJSON text: '[3, 4, 5]', returnPojo: false
                              JsonCollectorObject.element("Array", props)
                          }
                      }
                  }
                  
                  stage("Publish") {
                      steps {
                          script
                          {
                              Test = JsonCollectorObject.toString(3)
                              println(Test)
                              
                              Map dataMap = new JsonSlurperClassic().parseText(JsonCollectorObject.toString())
                              influxDbPublisher(selectedTarget: 'InfluxDB', customDataMap: dataMap)
                          }
                      }
                  }
              
              }
          }
          ----
          If I try to push the data to influx I get the response:
          {quote}[InfluxDB Plugin] Collecting data...

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2][InfluxDB Plugin] Custom data map found. Writing to InfluxDB...

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3][InfluxDB Plugin] Failed to collect data. Ignoring Exception:java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4][InfluxDB Plugin] Publishing data to target 'InfluxDB' (url='[—|https://influxtest.bu5.digital/]', database='testbucket')

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5][InfluxDB Plugin] Completed.
          {quote}
          I seems so that your plugin has a problem to push array data to influx. Why? Is it forbidden? How can I solve my problem?
          Christoph Hero made changes -
          Attachment New: PipelineExample.txt [ 58487 ]
          Christoph Hero made changes -
          Description Original: Hello,

          I am trying to push some customData to influxdb and everything works fine until I try to use an array in my data. To investigate the problem I wrote an small pipeline example with the following code:
          ----
          import groovy.json.JsonSlurperClassic

          pipeline {
              agent any
              
              environment {
                  JsonCollectorObject = null
                  Test = "Hallo"
              }
              
              stages {
                  stage("ClangTidy") {
                      steps {
                          script {
                              JsonCollectorObject = new net.sf.json.JSONObject()
                              
                              def props = readJSON text: '\{"Failed":  1, "Succeeded":  2, "ProcessedFiles":  3}', returnPojo: false
                              JsonCollectorObject.element("ClangTidy", props)
                          }
                      }
                  }
                  
                  stage("ClangFormat") {
                      steps {
                          script {
                              def props = readJSON text: '\{"Failed":  4, "Succeeded":  5, "ProcessedFiles":  6}', returnPojo: false
                              JsonCollectorObject.element("ClangFormat", props)
                          }
                      }
                  }
                  
                  stage("Array") {
                      steps {
                          script {
                              def props = readJSON text: '[3, 4, 5]', returnPojo: false
                              JsonCollectorObject.element("Array", props)
                          }
                      }
                  }
                  
                  stage("Publish") {
                      steps {
                          script
                          {
                              Test = JsonCollectorObject.toString(3)
                              println(Test)
                              
                              Map dataMap = new JsonSlurperClassic().parseText(JsonCollectorObject.toString())
                              influxDbPublisher(selectedTarget: 'InfluxDB', customDataMap: dataMap)
                          }
                      }
                  }
              
              }
          }
          ----
          If I try to push the data to influx I get the response:
          {quote}[InfluxDB Plugin] Collecting data...

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2][InfluxDB Plugin] Custom data map found. Writing to InfluxDB...

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3][InfluxDB Plugin] Failed to collect data. Ignoring Exception:java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4][InfluxDB Plugin] Publishing data to target 'InfluxDB' (url='[—|https://influxtest.bu5.digital/]', database='testbucket')

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5][InfluxDB Plugin] Completed.
          {quote}
          I seems so that your plugin has a problem to push array data to influx. Why? Is it forbidden? How can I solve my problem?
          New: Hello,

          I am trying to push some customData to influxdb and everything works fine until I try to use an array in my data. To investigate the problem I wrote an small pipeline example with the following code: see attachement [^PipelineExample.txt]

          If I try to push the data to influx I get the response:
          {quote}[InfluxDB Plugin] Collecting data...

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-2][InfluxDB Plugin] Custom data map found. Writing to InfluxDB...

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-3][InfluxDB Plugin] Failed to collect data. Ignoring Exception:java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-4][InfluxDB Plugin] Publishing data to target 'InfluxDB' (url='[—|https://influxtest.bu5.digital/]', database='testbucket')

          [http://---/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5|http://ntserv30:8080/blue/organizations/jenkins/Pipeline-Test/detail/Pipeline-Test/84/pipeline/#step-39-log-5][InfluxDB Plugin] Completed.
          {quote}
          I seems so that your plugin has a problem to push array data to influx. Why? Is it forbidden? How can I solve my problem?
          Christoph Hero made changes -
          Attachment New: PipelineExample-1.txt [ 58490 ]
          Christoph Hero made changes -
          Attachment Original: PipelineExample.txt [ 58487 ]
          Christoph Hero made changes -
          Attachment Original: PipelineExample-1.txt [ 58490 ]
          Christoph Hero made changes -
          Attachment New: PipelineExample.txt [ 58491 ]
          Aleksi Simell made changes -
          Link New: This issue duplicates JENKINS-53360 [ JENKINS-53360 ]
          Aleksi Simell made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

            aleksisimell Aleksi Simell
            ckak07 Christoph Hero
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: