Creating a “Days since last holiday” gauge #
It can be easy to forget to take holiday and end up forced to use up all your holiday days at the of the year.
Never again! With a Grafana gauge powered by QueryCal you can easily see if you’re overdue a day off.
- You track your days off in your your calendar (your company’s HR software might already do this for you!)
- A QueryCal account with your calendar added
Calculating the metric #
This recipe is going to use Grafana as an example to render the “Days since last holiday” metric as a gauge.
Grafana expects two values:
timewhich can be the current time as we’re calculating the live value of the metric.
valuewhich in this case is going to be the result of counting how many days since the last holiday event.
We can calculate these values using this query:
To customise this for your own calendar, you only need to change line 5 so that it matches your own holiday events.
Adding the gauge to Grafana #
To add the gauge to Grafana:
- Go to the dashboard you want to add the gauge to.
- Click the “Add panel” icon.
- Click “Add new panel”.
- Choose “Gauge” as the visualisation.
- Choose QueryCal as your data source and paste your SQL query.