I have 2 panels in a Grafana dashboard each containing a Table.
The first panel summarizes API errors by API name so looks like this:
Error Count API Name
203 API1
149 API2
100 API3
23 API4
The second panel display details about all API errors.
I want to be able to click on a row in the first panel, say on API2, and update the display in the second panel to only display API2 errors.
I have a variable named APIName which I have attempted to use in a data link, but it does want to work.
Both panels results are created by a Druid SQL source.
I try to use the APIName variable in the WHERE statement in the second panel but nothing happens.
Also, if I set a data link in the first panel, both the Error Count and the API Name values become links. Can this be confined just to the API Name?
Is a data link the way to go and if so, how do I use it? I tried assigning APIName=${__value.text} and the URL shows this when you hover over it, but this does nothing.
What am I doing wrong?
Thanks
You are asking several questions in one post but I will try to answer what I know.
- Yes I think that data links would be a good solution for this.
- Start by adding a variable (of type query) that lists all the api types. Let’s call this variable ‘APIName’.
- Make the second panel filtered by this variable. I am not familiar with Druid, but in ANSI SQL it would be something like
SELECT details FROM error_details WHERE api_name = ${APIName}
- Once you have a filter working for this one save the filtered URL somewhere for reference.
- Go back to the variable and make it hidden (change the variable’s
Show on Dashboard
settings toHidden
) - Edit the first panel and add a data link that points to the a URL that looks like
https://HOSTNAME/d/UUID/DASHBOARD?orgId=ORGID&var-APIName=${__data.fields.name}&${__url_time_range}
. Replace HOSTNAME, UUID, DASHBOARD, ORGID with the values saved in step 4.
Note that the URL name of the variable is var-APIName
.
As for the question if you can only set the link on one cell and not the entire row: yes, you can do it by adding an override to that cell and adding a data link to the override, see image below.