Define measurements in chain steps

Use the Script, Maven, or Gradle plugins to define custom measurements, capture them to a file, and publish them to PulseUno.

When you run a script with your measurements as part of a Script, Maven, or Gradle chain step, the script can generate a pulse-measurements.properties file, the contents of which PulseUno adds as custom measurements created by the step. You can then view these measurements in the user interface and pass them to other chain steps. For details, see Publish output variables to chain steps.

Guidelines for defining measurements:

  • To define custom measurements, your script must create the pulse-measurements.properties file. PulseUno will not recognize the file with a different name.

  • Use the following syntax for each line:

    measurement-name=measurement-value

  • Because pulse-measurements.properties is a Java properties file, use the ISO 8859-1 (ISO Latin1) 8-bit character encoding.

    To encode UTF-16 code units that are not in the ISO-Latin1 character set, use Unicode escape sequences such as \uXXXX, where XXXX is a 4-digit hexadecimal code point that represents a single character. For example, to encode the value €100.00 (one hundred euros), use the following escape sequence: \u20AC100.00

  • You can define the string, number, or boolean metric types by adding @string, @number, or @boolean to the relevant variable. For example, count@number=10 creates the count metric with the number value of 10.

  • You can paste your script into a step or use a script file that you checked in to the project's working directory. When the step completes, PulseUno will look for the pulse-measurements.properties file in the top directory of the chain’s build area (normally, the default working directory for the step).

  • Follow the syntax and character guidelines in Publish output variables to chain steps.

To define custom measurements in a chain step:

  1. In PulseUno, navigate to Spaces, select a space and then a product or Git repository.

  2. In the sidebar, select Chains.

  3. Open a chain from the chain list and click Edit.

    Or create a new chain, as described in Create chains.

  4. Add a Script, Maven, or Gradle step to the chain.

  5. Click the step to configure it.

  6. In the step's parameters, specify the script that the step will run:

    Script

    Runs a batch file (Windows) or shell script (other systems).

    To add your script:

    1. Select the script language.
    2. Enter your script in the Command line box.

      Alternatively, from the Location list, select File in workspace, and enter a path to the script file, for example, scripts/runstep.bat.

    Maven By default, runs a pom.xml file from the working directory.
    Gradle By default, runs a build.gradle file from the working directory.
  7. Configure other parameters. For details, see the Gradle, Maven, or Script description in Use plugins.

  8. Click Save.

When PulseUno runs the step, it will read any custom measurements from the pulse-measurements.properties file, but only if your script creates the file.

To view the measurements in PulseUno, open a chain run and select the Measurements tab.

Back to top

See also: