title: Grafana Prometheus Counter
body: <p><a href="https://i.stack.imgur.com/fXerI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fXerI.png" alt="enter image description here" /></a>I have trying to get exact count for an event in a Grafana visualization using Prometheus as timeseries DB. But the counter is showing incorrect records. I am getting a higher count for 2 days that I am getting 7 days, which definately points to something being wrong.</p>
  <p>First I have used a single stats visualization with this promql query:</p>
  <p><code>sum(increase(http_server_requests_seconds_count[$__range])). </code></p>
  <p>P.S.</p>
  <p>I have also tried the following :
  <code>sum(increase(http_server_requests_seconds_count[1m]))</code> .
  This also gives incorrect counts.</p>
  <p>I have tried the same with graph and using the legend to show totals in table. This is also gives incorrect counts.</p>
  <p>Please let me know what is the best way of showing counts which can be reliable over time range changes.</p>
  <p>My json :</p>
  <pre><code>{
      &quot;colorMode&quot;: &quot;value&quot;,
      &quot;fieldOptions&quot;: {
          &quot;calcs&quot;: [
              &quot;lastNotNull&quot;
          ],
          &quot;defaults&quot;: {
              &quot;mappings&quot;: [],
              &quot;thresholds&quot;: {
                  &quot;mode&quot;: &quot;absolute&quot;,
                  &quot;steps&quot;: [{
                      &quot;color&quot;: &quot;green&quot;,
                      &quot;value&quot;: null
                  }]
              }
          },
          &quot;overrides&quot;: [],
          &quot;values&quot;: false
      },
      &quot;graphMode&quot;: &quot;area&quot;,
      &quot;justifyMode&quot;: &quot;auto&quot;,
      &quot;orientation&quot;: &quot;auto&quot;
  },
  &quot;pluginVersion&quot;: &quot;6.6.1&quot;,
  &quot;targets&quot;: [{
      &quot;expr&quot;: &quot; sum(increase(http_server_requests_seconds_count[$__range]))&quot;,
      &quot;hide&quot;: false,
      &quot;instant&quot;: true,
      &quot;refId&quot;: &quot;A&quot;
  }],
  &quot;timeFrom&quot;: null,
  &quot;timeShift&quot;: null,
  &quot;title&quot;: &quot;Total Number of Requests&quot;,
  &quot;type&quot;: &quot;stat&quot;
  }
  </code></pre>