sum(argocd_app_info{namespace=~"$namespace",dest_server=~"$cluster",health_status=~"$health_status",sync_status=~"$sync_status",health_status!=""}) by (health_status)
and I’m wondering how to rewrite this query, such that if the last value is missing, it defaults to zero?
In Grafana, I tried using both Last and Last*, but they return the same result.
I think the query you’re looking for (that sets the no data to 0) is
sum(argocd_app_info{namespace=~“$namespace”,dest_server=~“$cluster”,health_status=~“$health_status”,sync_status=~“$sync_status”,health_status!=“”}) by (health_status) or on() vector(0)
Should work (notice that it will keep the 0 series for a longer period of time, I didn’t get around to research for how long).
I tried it on my own instance and worked for me The or on() vector(0) should ensure if your health_status has no data, it should do 0. or vector(0) on its own would create just a 0 vector