Adding trends
Our dashboard is already looking pretty good, but Dashing offers a few features that are both easy to implement and quickly and easily add additional data and means of discovery. One of the quickest and easiest additions is adding trends to our Puppet metrics to allow people to see at a glance how data is changing over time. This is achieved using the numbers widget that we've already used. The numbers widget is not just limited to displaying the current dataset; it can also display a second field, which is the percentage change from the last run, complete with an appropriate arrow to denote how the data has changed.
As we've already mentioned, the numbers widget accepts fields in JSON format; we've already given it one field, :current
, and now we're going to give it a second field, :last
. This will give the numbers widget the data it needs to draw the trend data, and this :last
field represents the last reading that this widget displayed. Let's go ahead and alter our code to...