Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

MeasurementDataRelated plugin
All
  • Build number
  • Project name
  • Project path

jenkins_data
  • Build health
  • Build status message
  • Build time
  • Build Agent name
  • Job duration
  • Build result
  • Build result ordinal (0=Stable, 1=Unstable, 2=Failure, 3=Not built, 4=Aborted, 5=Unknown (for pipelines))
  • Successful build boolean
  • Last stable build number (or 0 if never)
  • Last successful build number (or 0 if never)
  • Tests failed (unit test results from JUnit Plugin)
  • Tests skipped (unit test results from JUnit Plugin)
  • Tests total (unit test results from JUnit Plugin)
  • Time in queue (from Metrics plugin)
  • Build scheduled time
  • Build start time
  • Build measured time

JUnit Plugin

Metrics Plugin

cobertura_data
  • Package coverage %
  • Class coverage %
  • Line coverage %
  • Branch coverage %
  • Amount of packages
  • Amount of source files
  • Amount of classes
Cobertura Plugin
rf_results
  • Test case name
  • Suite name
  • Duration
  • Amount of suites
  • Amount of passed tests
  • Amount of failed tests
  • Amount of total tests
  • Pass percentage of all tests
  • Amount of passed critical tests
  • Amount of failed critical tests
  • Total amount of critical tests
  • Pass percentage of critical tests
Robot Framework Plugin
suite_result

Same as rf_results except:

  • Pass percentage of all tests
  • Pass percentage of critical tests
  • Test case name
Robot Framework Plugin
tag_point

Same as rf_results except:

  • Pass percentage of all tests
  • Pass percentage of critical tests
  • Test case name
  • Suite name
  • Amount of suites

Extra data sent for this measurement:

  • Tag name
Robot Framework Plugin
testcase_point

Same as rf_results except:

  • Amount of suites
  • Amount of total tests
  • Pass percentage of critical tests
  • Total amount of critical tests
  • Pass percentage of all tests
Robot Framework Plugin
jacoco_data
  • Package coverage %
  • Class coverage %
  • Line coverage %
  • Branch coverage %
  • Method coverage %
  • Instruction coverage %
Jacoco JaCoCo Plugin
performance_data
  • Total amount of errors
  • Percentage of errors
  • Average sample duration
  • Max/min sample duration
  • Size of samples
  • Total count of samples
  • 90 percentile
Performance Plugin

sonarqube_data

  • Amount of major/minor/critical/blocker/info issues
  • Lines of code
  • Build display name
-
changelog_data
  • Affected files
  • Commit authors
  • Commit messages
  • Commit count
-
perfpublisher_summary
  • Number of total/executed/not-executed/passed/failed/success/true-false tests
  • Best compile time test value/name
  • Worst compile time test value/name
  • Average compile time
  • Best performance test value/name
  • Worst performance test value/name
  • Average performance
  • Best execution time test value/name
  • Worst execution time test value/name
Perfpublisher Plugin
perfpublisher_metric
  • Metric name
  • Average value for metric
  • worst value for metric
  • best value for metric
Perfpublisher Plugin
perfpublisher_test
  • Test name
  • Was test successful/executed
  • Test message
  • Compile time
  • Execution time
  • Performance
Perfpublisher Plugin
perfpublisher_test_metric
  • Test name
  • Metric name/value/relevancy
Perfpublisher Plugin

...

Code Block
step([$class: 'InfluxDbPublisher',
		selectedTarget: 'myTarget',
        customData: null,								// OPTIONAL
        customDataMap: null,							// OPTIONAL
        customPrefix: null,
        target: 'local influxDB',
		selectedTarget: 'local InfluxDB',               								// OPTIONAL,
recommended if you have multiple InfluxDB targets configured to ensure you write to correct target
		jenkinsEnvParameterTag: 'KEY=' + env.PARAM,		// OPTIONAL, custom tags
		jenkinsEnvParameterField: 'KEY=' + env.PARAM,   // OPTIONAL, custom fields
		measurementName: 'myMeasurementName',           // OPTIONAL, custom measurement name. Replaces default "jenkins_data" and "jenkins_custom_data"
		replaceDashWithUnderscore: true,                // OPTIONAL, replace "-" with "_" for tag names. Default=false
	])

...

Code Block
try {
    // Build things here
    if (currentBuild.result == null) {
        currentBuild.result = 'SUCCESS'	// sets the ordinal as 0 and boolean to true
    }
} catch (err) {
    if (currentBuild.result == null) {
        currentBuild.result = 'FAILURE'	// sets the ordinal as 4 and boolean to false
    }
    throw err
} finally {
    step([$classinfluxDbPublisher selectedTarget: 'InfluxDbPublishermyTarget',
...])
}


From version 1.19 onwards, it's also possible to create and remove targets in pipelines.

Code Block
languagegroovy
titleCreate a target in pipeline
linenumberstrue
// Get InfluxDB plugin descriptor (version < 2.0)
def influxdb = Jenkins.instance.getDescriptorByType(jenkinsci.plugins.influxdb.DescriptorImpl)

// version >= 2.0
def influxdb = Jenkins.instance.getDescriptorByType(jenkinsci.plugins.influxdb.InfluxDbStep.DescriptorImpl)

// Create target
def target = new jenkinsci.plugins.influxdb.models.Target()

// Set target details
// Mandatory fields
target.description = 'myNewTarget'
target.url = 'http://influxdburl:8086'
target.username = 'myUsername'

// version < 2.0
target.password = 'myPassword'

// version >= 2.0
hudson.util.Secret password = hudson.util.Secret.fromString('myPassword')
target.password = password

target.database = 'myDatabase'

// Optional fields
target.exposeExceptions = true // default = true
target.jobScheduledTimeAsPointsTimestamp = true // default = false
target.usingJenkinsProxy = true // default = false
target.retentionPolicy = '1d' // default = 'autogen'
// NEW in version 1.20.1
target.replaceDashWithUnderscore = true // default = false

// Add a target by using the created target object
influxdb.addTarget(target)
influxdb.save()

// Write stuff to InfluxDB
// NOTE! If you have more targets configured in Jenkins, it's safer to add "selectedTarget" parameter to the InfluxDB step to ensure
// data is sent to the correct target.
// step([$class: 'InfluxDbPublisher', selectedTarget: 'myNewTarget', customPrefix: 'myPrefix', customData: myDataMap])
// OR (version >= 2.0)
// influxDbPublisher customPrefix: 'myPrefix', customData: myDataMap, selectedTarget: 'myNewTarget'

// Remove a target by using the target description field value
influxdb.removeTarget('myNewTarget')
influxdb.save()

...

Code Block
languagegroovy
def myDataMap = [:]
myDataMap['myKey'] = 'myValue'
step([$class: 'InfluxDbPublisher', targetselectedTarget: 'myTarget, customPrefix: 'myPrefix', customData: myDataMap])

...

Code Block
languagegroovy
def myDataMap1 = [:]
def myDataMap2 = [:]
def myCustomDataMap = [:]
myDataMap1['myMap1Key1'] = 11 // first value of first map
myDataMap1['myMap1Key2'] = 12 // second value of first map
myDataMap2['myMap2Key1'] = 21 // first value of second map
myDataMap2['myMap2Key2'] = 22 // second value of second map
myCustomDataMap['series1'] = myDataMap1
myCustomDataMap['series2'] = myDataMap2
step([$classinfluxDbPublisher selectedTarget: 'InfluxDbPublisher', target: myTarget, customPrefix: 'myPrefix', customDataMap: myCustomDataMap])

This creates measurements series1 and series2 and adds the keys myMap1Key1 and myMap1Key2 with values 11 and 12 respectively to series1; and myMap2Key1 and myMap2Key2 with values 21 and 22 respectively to series2.

...