Stat panel doesnt match with time series same query

stat panel doesnt match with time series panel, using the same query

I just want to re-phrase my issue for a better understanding: stat panel doesnt match with time series panel. I’m using the same promQL query, source is Prometheus

Time series panel is showing the correct information, if I get N alerts from Slack, I see N spikes in Time series panel. The issue is with Stat panel, not getting the right number.

Also, wondering if the Stat panel is the best option for my goal. Is there another panel that works better?

Regards

Using Grafana v9.4.3

I was trying Table panel as well, added some transformation stuff but still no luck

Time series graph shows time series (a lot of value and each value has timestamp)

Stat panel doesn’t have that “time” dimension, so it must aggregate multiple values into single value. That single value uses a configured calculation, so configure it for your need:

Thanks for your response. I have tried the configured calculation for Stat panel, no luck.

Got a few questions:

1- Do I need to add any transform in Stat panel to achieve my goal?

2- Is there a better panel rather than Stat panel for this matter?

1.) No
2.) I don’t know. You didn’t specify your target.

Your problem description is vague. There is no data, screenshots, expected result, etc. Be more specific, and you will have a higher chance of getting more accurate advice for your case.

1 Like

Problem description: Time series panel is showing the correct information, if I get N alerts from Slack, I see N spikes in Time series panel. The issue is with Stat panel, not getting the right number.

If I get 3 alerts in Slack, I’ll see 3 spikes in Time series panel. But Stat panel shows me another number

My goal is Stat panel to show the count of spikes I see in Time Series Panel

Query: sum(increase(xxx_count_total{service=“$service”,namespace=“$namespace”,result=“failure”}[5m])) >= 5

Regards,

Be specific. Please follow this template for a proper problem description:

I have Time series panel:
[screenshot]
[query]
[data - raw values]

I have Stat panel:
[screenshot]
[Stat panel configuration]
[query]
[data - raw values]

Stat panel shows number X, but I expect number Y, because [calculation how Y value can be calculated from raw values]

I use Grafana v9.4.3. Any ideas how to get my desired result?

Data/query/logs should be properly text formated (no screenshots).

I have Time series panel:

[screenshot]
Query: sum(increase(xxx_count_total{service=“$service”,namespace=“$namespace”,result=“failure”}[5m])) >= 5

[data - raw values]:

23/04/2025, 10:04:00. 10

23/04/2025, 10:06:00. 11

I have Stat panel:

[screenshot]
[Stat panel configuration]
Query
sum(increase(xxx_count_total{service=“$service”,namespace=“$namespace”,result=“failure”}[5m])) >= 5
[data - raw values]: 23/04/2025, 10:05:00 12

Stat panel shows number 12, but I expect number 1, because [calculation how Y value can be calculated from raw values]

I use Grafana v9.4.3. Any ideas how to get my desired result?

Data/query/logs should be properly text formated (no screenshots).

I think nobody understands your calculation(business logic), which will result in 1 from the promql query, which returns 12. Pls provide the calculation on how anyone can reach your desired result.


here is an example of 2 firing alerts - I got 2 firing alerts into my Slack, which is fine. but as you can see it’s 54 flaps and I dont want to count them all, just 2 in this case.

I have the same query in both panels. the top one is a stat which i want to fix.

1 Like

please share the query for the 54

This is the query I’m using for both panels:

sum(increase(xxx_count_total{service=“$service”,namespace=“$namespace”,result=“failure”}[5m])) >= 5

See the graph i got using this query:
count(sum(increase(xxx_count_total…

The value is 1, I’m expecting 2. But I see 2 bars. It’s promising but I have no clue how to get the expected value, in this case number 2

Sounds like you need to count and grouped by some other value

Right now you are just counting the sum value which is 54 which is 1

Can you please advise on this?. i have tried this query too, no luck:

count_over_time(ALERTS{alertname=“xxxx”, alertstate=“firing”}[15m])

count_over_time(ALERTS{alertname=“xxxx”, alertstate=“firing”}[$_range])