# Gauge for percentage error rate not showing correct calculation

**URL:** <https://community.grafana.com/t/gauge-for-percentage-error-rate-not-showing-correct-calculation/80403>\
**Category:** Prometheus\
**Tags:** gauge-panel, prometheus, query-help\
**Created:** [January 25, 2023, 1:44pm UTC](https://community.grafana.com/t/gauge-for-percentage-error-rate-not-showing-correct-calculation/80403 "2023-01-25T13:44:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![edtshuma](https://avatars.discourse-cdn.com/v4/letter/e/4da419/32.png) [@edtshuma](https://community.grafana.com/u/edtshuma)\
**Post date:** [January 25, 2023, 1:44pm UTC](https://community.grafana.com/t/gauge-for-percentage-error-rate-not-showing-correct-calculation/80403/1 "2023-01-25T13:44:41Z")

</div>

I am trying to visualize the percentage of requests that resulted in error (minute by minute) via a Grafana gauge but the Gauge is not showing the correct value. For example when I execute 10 requests within a 1 minute interval - where 5 of those requests result in HTTP 200 and 5 result in HTTP 500 then I expect the Gauge to show 50% error percentage. However the value stays at 100% regardless that I have been sending successful and unsuccessful requests to the API :

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/e/0/e036cb9c1d33d48c2024b179d64b6b3fd05a4c7b.png)

This is the corresponding query :

```auto
100 * (sum(sum_over_time(total_requests_gauge{status_code!="200"}[1m]))/ on() group_left() sum(sum_over_time(total_requests_gauge[1m])))

```

I have configured the Gauge unit to Percent :

![image](https://us1.discourse-cdn.com/grafana/original/3X/3/b/3b79f10d5a7c2643d44dfdce8c2b70741833ac96.png)

Prometheus is scrapping the metrics correctly at _**[http://localhost:9090](http://localhost:9090)**_ as well as the API endpoint at _[http://localhost:80/metrics](http://localhost:80/metrics)_

I also have an endpoint (.Net Core 5) that always returns error responses :

```auto
[AllowAnonymous]
    [HttpPost("problem")]
    public IActionResult Problem([FromBody] RegisterModel model)
    {
        //always returns HTTP 500 error      
            return Problem();
    }

```

Grafana Version : 9.3.2

---

<div class="post-metadata">

**Author:** ![usman.ahmad](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/usman.ahmad/32/29706_2.png) [@usman.ahmad](https://community.grafana.com/u/usman.ahmad)\
**Post date:** [January 26, 2023, 5:10pm UTC](https://community.grafana.com/t/gauge-for-percentage-error-rate-not-showing-correct-calculation/80403/2 "2023-01-26T17:10:47Z")

</div>

Hi @edtshuma,

Thanks for opening this post.

This sounds more like a Prometheus query issue rather than the Gauge Panel, therefore moved it to the Prometheus Category.

Also, saw that you already found a [solution](https://stackoverflow.com/questions/75234284/grafana-gauge-for-percentage-error-rate-not-showing-correct-calculation) from another resource so posting it here to make the post complete and helpful for other community users 🙂
