Hi there,
I hit following issue when using Prometheus + Grafana, and want to check if this is a bug in Prometheus query.
Scenario:
I am using Prometheus to collect CPUUtilization for aws instances. In one dashboard, I want to show the metrics for services which are underutilized. To do this, I first use Grafana Variable "underutilized_services" to find out the service names; then I use this Variable in my Prometheus query to show the actual CPUUtilization data for these services.
I am using following Prometheus query:
"avg by (service_id)($Metric{service_id=~"$underutilized_services"})"
and $underutilized_services" is a list of service names, like service1, service2...
It is working well when the $underutilized_services is not empty, like folllwing (first graph)
But if the $underutilized_services is empty, then my understanding is that it should now "No Data", but somehow it is showing something wired, like following (second graph).
If you look at the legend of the second graph, it shows:
"avg by (service_id)(aws_ec2_cpuutilization_p50{service_id=~"()"})"
It looks like above query actually returns some value, which in my opinion it shouldn't.
This is showing some confusing data for my customer. Ideally it should show "No Data" in the second case.
Is there a bug in Prometheus? Or I am not using the query correctly?