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

Not able to send data to Influx DB using Groovy Closure

XMLWordPrintable

      I am trying to send the data from a groovy map in iterations to influx DB. The data is collected using 

       

      def testCaseDuration = ''
      def testCaseDetails = [:]
      
      def xmlText = new XmlSlurper().parseText(xml)
      
      xmlText.testsuite.testcase.each { testcase ->
          testCaseDuration = testcase['@time'].toString()
          testCaseDuration = testCaseDuration.substring(testCaseDuration.lastIndexOf(":") + 1)
          testCaseDetails[testcase.@name] = testCaseDuration
      }
      
       
      
      testCaseDetails.each { testcase, duration ->
          println "testCaseDetails in loop: TestCase Name: ${testcase} = TestCase Duratiom ${duration}"
      
          def testField = [:]
          def testTag = [:]
          def testDataMeasurementFields = [:]
          def testDataMeasurementTags = [:]
          testField['total'] = testcase
          testField['passed'] = duration
          testTag['infra'] = 'aws'
          testTag['space'] = 'dev'
          testDataMeasurementFields['apitest1'] = testField
          testDataMeasurementTags['apitest1'] = testTag
      
          influxDbPublisher(selectedTarget: 'jenkins', customDataMap: testDataMeasurementFields,
          customDataMapTags: testDataMeasurementTags)
      
      }
      

       

      The first insertion to influx DB happens and following which it gives the below error 

       
      20:14:29 in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@5fe1b10b*20:14:29* Caused: java.io.NotSerializableException: groovy.util.slurpersupport.NodeChild

       

      How do i push the data to influxDB using the loop or closure in jenkins pipeline

            vjuranek vjuranek
            karthik_hg Karthik HG
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: