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

Custom fields/tags not added to measurements

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • influxdb-plugin
    • None

      I want to add custom fields to my global listener measurement for a build.

      As I understand from the Global Listener Documentation, I have the option to set the environment variables 

      INFLUXDB_PLUGIN_CUSTOM_FIELDS
      INFLUXDB_PLUGIN_CUSTOM_TAGS 

      The note states

       

      "The environment variables must be set on the final build object. If you are creating or updating these variables in a pipeline, you should make sure they are exported with an EnvironmentContributingAction."

      I tried setting the variables in the pipeline environment, for example

       

      pipeline {
        environment {
          INFLUXDB_PLUGIN_CUSTOM_FIELDS = "foo=bar"
        }
        ...
      } 

      but the data doesn't appear in my InfluxDB measurement.

       

      I took a look into the code but I can't find a mistake there. What is the correct way to set the environment variable on the "final build object"? Could you please give an example for that?

      Cheers!

       

      Update

      I even set the environment variable INFLUXDB_PLUGIN_CUSTOM_FIELDS globally for my build agent but it still isn't added to the measurement.

       

      Update2

      Setting the environment variable globally (not only for the build agent but in "Manage Jenkins") does the job. But that brings me back to the question: How can you set this variable in a pipeline? I would be very happy about an example

            aleksisimell Aleksi Simell
            g3n35i5 Jan-Frederik Schmidt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: