Chained panel queries

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

  • v10.4.0

  • What are you trying to achieve?

I have a specific use case where I embed my Grafana panels into another (own) site. I create a dashboard with a variable. The variable is essentially an HTTP request to an API which retrieves some JSON and that JSON is stored as a raw value in the variable itself.

Then, I have a Grafana panel with a JSON API datasource which uses the value of that variable (the JSON response from the variable HTTP request) and it sends it to another HTTP API in the request to retrieve some time series data.

So, long story short, my variable contains the JSON returned from one API and then that value (JSON) is sent to another API whose response will be the time series data that the JSON API plugin / Grafana itself will be able to transform.

Now, my issue is that if I have 2 different Grafana panels which require “a different” variable, when I embed one of the panels on a page, behind the scenes (in the network), Grafana will execute all variable requests (because they’re dashboard variables) even though this particular panel does not need all of them (it references / uses only one of the total two dashboard variables). If I move this one variable into the panel’s data sources, I cannot chain 2 panel queries (query A’s response being referenced in query B, for example) - is there a nice workaround for this?