Unable to display ad-hoc filter in text widget

  • What Grafana version and what operating system are you using?
    v10.4.1

  • What are you trying to achieve?
    I’m attempting to use the default text widget to display the ad-hoc filters as part of a template. This dashboard is intended to be used as a discovery dashboard to use the queries they build to populate a yaml configuration later.

  • How are you trying to achieve it?
    I have a variable called additional_filters that is set as an ad-hoc filter.

Then in the text widget it’s using HTML and this setup for the configuration…

<div class=\"box\"><pre>
<code>slos:
  ${DS_PROMETHEUS}-slo:
    objective: ${objective}
    latencySLI:
      metric: ${main_metric}
      commonFilters:
        - ${additional_filters}
      errorFilters:
        - le="${latency}"
</code></pre></div>
<p>
Some additional template instructions....
</p>
  • What happened?
    The ${additional_filters} reference for “commonFilters” always shows up blank. Tried a couple different variable syntax options which doesn’t display the variable either. There weren’t any errors in the Grafana UI.

  • What did you expect to happen?
    The ad-hoc filters to be displayed in the text widget.

  • Additional Comments
    I expect it’s the way ad-hoc filters are handled and only are added to queries that is why it’s not being displayed. I’m sure there is a way to achieve this via a custom panel but just want to check that I’m not missing something using the default Grafana panels/templating.