We’re hard at work on 0.10.0, Chronograf’s next major release. Plenty of new features and improvements are in store, and we wanted to give a quick preview of our take on an oft-requested feature: template variables.
Keep in mind that 0.10.0-rc1 still has some rough edges as we move towards the final 0.10.0 release and shouldn’t be relied on in production.
Template variables allow you to apply a value across multiple queries. 0.10.0-rc1 introduces support for templated time ranges and tags via the `tmplTime()` and `tmplTagValue()` functions.
Use the `tmplTime()` function to apply the globally selected time range to a particular query. This works for queries that use the query builder as well as queries entered manually:
Using template variables for tags prevents you from having to duplicate groups of visualizations across dashboards. Say you were running an application on multiple hosts and had a dashboard to monitor system metrics (cpu, memory, etc.). Instead of configuring a dashboard for each host via an API or by hand (neither option being ideal), you could use a template variable for the tag key`host`. Simply head to the query builder, select a tag key, and choose the ‘Make Variable’ option to turn that tag pair into a templated variable: