Jenkins CI and the “Plot Plugin” — plot your data! show where your figures are going!

This plugin provides generic plotting (or graphing) capabilities in Jenkins.

  • The sample Jenkins job creates an XML file within a build step.
  • Some post build action “plot build data” extracts values using XPath expressions.
  • For a build resp. time series (i.e. covering all your builds) plot it makes sense to check “keep records for deleted builds“.

I don’t really find the plugin’s documentation itself rather intriguing. But I came across a simple example at work. And that example was rather self-describing and impressive. A couple of weeks later I was asked to create a rather special use graphic, and I wondered for a while, how I would achieve that. Luckily enough I was able to reduce the “rather special use graphic” to a very simple use of the plot plugin.

My preferred use case:

  • let the “build step” create a minimalistic XML file
  • let a plot “post build step” specify the plot by an XPath expression,
  • the attribute (of the XPath expression) is used for naming the curve
  • if you list more than one XPath expression, you will get one curve per one XPath expression, each of them properly named and rather easy to distinguish
  • do you want to show something like the “maximum y”? nothing easier than that. add your “max-y” as an attribute to your XML file! looks overdone? don’t be silly!
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<map_file>
  <totals       max_readonly_memory="700000" 
              total_readonly_memory="372155" 
               readonly_code_memory="286914" 
               readonly_data_memory="85241"

          max_readwrite_data_memory="100000" 
              readwrite_data_memory="70195"
          />
</map_file>
  • I am creating a “Plot group” called “ROM+RAM“,
  • one “Plot title” being “ROM“,
  • the other being “RAM“.
  • I do want to “keep records for deleted builds“.
  • I am naming the “Data series file” … .
  • I do “Load data from xml using xpath“.
  • My “XPath Result type” is a “Nodeset
  • Here is my XPath expression (all on one line within that text field):
//map_file/totals/@max_readonly_memory | //map_file/totals/@total_readonly_memory | //map_file/totals/@readonly_code_memory | //map_file/totals/@readonly_data_memory

Yes, you do need a couple of build runs for getting an impressive plot picture. The application running within the respective Jenkins job would be a little heavy to run only for achieving my wonderful plot. I developed a tiny Perl script instead that creates XML files of this kind with rather random values.

Should the demand for my scripts and XML file rise … — I can always upload my files to my github space. Drop me a line!


Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.