Table panel render additional columns by invoking separate queries based on existing cell data

Hello team - I am rendering a table panel with data returned from a JSON data source query.

Example:

Now I want to add two more columns with color coding such that each column “Container Health” and “Alert Status” are fetched from different data sources by providing container name and version as input to those queries. Is it possible to render columns by using data from a table cell

I tried exploring ‘join’ and ‘config from query’ transformations to achieve this but I can’t figure out a proper solution:

Is it possible to render additional table panel columns like so by querying secondary data sources using cell values from a table which was rendered from the first datasource? Any other suggestions on getting this done? I am wondering if I can use chained template variables to achieve this but can’t figure out how. Appreciate any help!

Hi,

can you share the data in three tables format (like the data returned from your datasource)? Join transformation should have worked (with Inner mode). For coloring you can use value mapping with field overrides (to apply the colors to only desired columns).

Thanks for the response! So there is one query for the ‘main’ table:

query1:

[{
  "name": "container-1",
  "type": "Linux",
  "version": "1.1.1"
},
{
  "name": "container-2",
  "type": "K8s",
  "version": "2.2.2"
},
{
  "name": "container-3",
  "type": "K8s",
  "version": "3.3.3"
}] 

I need to call another API for Alert Status that uses container “name” from first query to call the API via GET URL like : http://my-alerts-api.com/filter?name=container-1 which will give me a result of “OK” or “NotOK” in JSON eg:

{
  "status": "OK"
}

I’m wondering if there is a provision to query the alerts API repeatedly for each container name this way? I was thinking of creating a hiddent template variable $containerName that simply gets the list ["container-1","container-2","container-3"] and use that in the table panel infinity plugin query to get a resulting JSON like:

[{
  "name": "container-1",
  "alertStatus": "OK"
 },
 {
  "name": "container-2",
  "alertStatus": "NotOK"
 },
 {
  "name": "container-3",
  "alertStatus": "OK"
 }]

so that I can then join these two tables to get my desired results (value mapping for coloring makes sense per your suggestion). Not sure if this is possible? I was tinkering with JSONata to transform the json object itself, but again since it’s just a parser I’m not sure if that allows for any inner querying ability to return results from external APIs (I don’t think so, but wanted to rule this out as a possibility)

Finally, if grafana doesn’t inherently allow this sort of chained querying functionality then I guess I’ll just have to write my own API to return the desired json data format so that I can join them on grafana side using a field name or label using the join transformation

You could do this using business text plugin and JavaScript

The 1st API can be done using infinity and the rest can be done via JavaScript