Dashboarding
Dynatrace dashboards, notebooks, and data explorer explained.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Be able to use no Data result on dashboard to change the tile red.

dougwillis
Frequent Guest

Hi,

I would like to have an option on the visualization colours that if a no records result is returned for the query that I can change the color of the tile to a specific color.  Is there a way to do this with DQL?

For example, I have a DQL looking at Keda and metrics-server on a dashboard.
It returns a series of rows with pod status if the services are installed. I set a color filter in the visual to highlight a row if there are no running pods.

If these services are removed for any reason and the DQL returns a No Records response I want to use that as a signal to set the tile background to red as that is also an error as these pods should always be deployed in the cluster.


2 REPLIES 2

t_pawlak
Leader

Yes, but I would not rely on the visualization handling the native “No records” state directly.

The usual workaround is to make the DQL always return one row/value. If the expected pods are missing and the query would normally return no records, return a synthetic status value instead, for example status = "MISSING" or value = 1. Then you can use the dashboard color rules to make that value red.

So instead of allowing the tile to end in “No records”, transform the query result into an explicit health/status result that the visualization can color.

You could try something like this (replace {{Your_metric}} with your metric):
timeseries { sum({{Your_metric}}, default: 0), nonempty:true}, interval: 1m

This will return 0 (default) when no data (nonempty:true) is available instead of leaving the result empty.
That allows you to configure a color rule for the value 0, making it easy to visually distinguish periods where no data is found.

An alternative is to use -1 as default when no data is available, which lets you distinguish between zero values and missing data. (Note: that switching the visualization to a single value will obviously affect your results in this case.)
if you want to use single value use the following DQL ==>
timeseries { sum(log.roro.loglevel.error, default: -1), nonempty:true, value.A = sum(log.roro.loglevel.error, default: 0, scalar: true) }, interval: 1m
Use value.A as the single value and keep sum(...) as the sparkline.

Featured Posts