Graph panel showing asPercent values only shows the first query marked as visible

Hello,

I am trying to graph node status for a cluster based on a ganglia rrd that is visible to grafana through a graphite data source. I can show the count of nodes fine, but I wanted to show them as a percentage in the legend, so I calculate the total number of nodes as one of my metrics and I tried using the asPercent function with the result of that query in my other queries. It seems to work, but it only shows the first one that is marked visible and shows the others with no values. The query inspector shows that these are all coming back as n: Array[null,].

This screen shot shows with all three states (A,I,O) marked as visible. Only “A” shows up in the legend and graph:

This shows when “A” is marked invisible, then “I” starts to appear and it is not all 0’s:

I am working around it by using a static value for the number of nodes and using a scale function to get the percentages, but the number of nodes can change so I was hoping to be able to calculate the total at query time.

Thanks!

Have you tried a single query of asPercent(test.slurm_cpus_[AIO]_4x4x4.sum)? That should give you the values you’re looking for as efficiently as possible.

That’s great, no I had not tried that. Thank you!

To alias the names, I came up with this query but it is pretty ugly. Is there a better way?
aliasSub(aliasSub(aliasSub(asPercent(test.slurm_cpus_[AIO]_4x4x4.sum), '.*_A_.*', 'Allocated'), '.*_I_.*', 'Idle'), '.*_O_.*', 'Drained')

That’s likely going to be your best option right now

Understood, thanks again for the fast replies!