how to handle Grafana node graph throwing exception when nodes and edge datasets are empty?
-
What Grafana version and what operating system are you using?
version 12.2 -
What are you trying to achieve?
Nodegraph visualization -
How are you trying to achieve it?
Querying prometheus metrics using two seperate queries to get two datasets nodes and edges -
What happened?
There are instances when my datasets have no data. In such a case the node graph throws exception saying it’s looking for an “id” column.I did use a workaround by creating dummy node and edges, so the panel shows “No Connections” instead of throwing exceptions. I just want to know if there’s a better way to handle this.
Nodes:
(
label_replace(
label_replace(
vector(0),
“id”,“no-data”,“”,“”
),
“title”,“No Agents Connected”,“”,“”
)
)
unless
<my actual query>Edges:
(
label_replace(
label_replace(
label_replace(
vector(0),
“id”,“no-edge”,“”,“”
),
“source”,“no-data”,“”,“”
),
“target”,“no-data”,“”,“”
)
)
unless
<My actual query> -
What did you expect to happen?
Show “No Data” when datasets are empty -
Can you copy/paste the configuration(s) that you are having problems with?
-
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
-
Did you follow any online instructions? If so, what is the URL?
Node graph | Grafana documentation


