DEV Community

[Comment from a deleted post]
Collapse
 
avinash917 profile image
Avinash reddy
✅ Correct query for Active Partners (Unique Partner IDs)
count_values("partnerId", {namespace="nginx-controller"} |= "ren-prod-us" |= "gcs-pet-saas" | json | unwrap upstream_http_partnerId)


Then, in Grafana:

Panel type → Stat

Calculation → Count

The panel will show the number of unique partner IDs active in the selected range.

⚡Alternative if you want just total number (not names)

You can aggregate the output of count_values():

sum(count_values("partnerId", {namespace="nginx-controller"} |= "ren-prod-us" |= "gcs-pet-saas" | json | unwrap upstream_http_partnerId))


That gives you a numeric total — a single number you can display in a stat panel.

✅ Tip:
If you still see “No data,” try verifying with this quick check query:

{namespace="nginx-controller"} |= "ren-prod-us" |= "gcs-pet-saas" | json | line_format "{{.upstream_http_partnerId}}"


If this returns IDs (like idwatchdog, partnerx etc.), the main query will definitely work.
Enter fullscreen mode Exit fullscreen mode