Kasper Grubbe
Kasper Grubbe

Reputation: 943

Difference between two Grafana panels singlestat and graph with same query

I have created the following Grafana dashboard:

enter image description here The singlestat panel uses the following query:

SELECT sum("value") FROM "rails.pageviews" 
WHERE $timeFilter 
GROUP BY time($__interval) fill(null)

And the graph panel uses the exact same query:

SELECT sum("value") FROM "rails.pageviews" 
WHERE $timeFilter 
GROUP BY time($__interval) fill(null)

How do I make the single-stat panel show the total amount of pageviews? It should be 12 (8+2+2) and not 4, right?


When I debug the data returned from Influxdb:

response:Object
  results:Array[1]
    0:Object
    statement_id:0
    series:Array[1]
      0:Object
      name:"rails.pageviews"
      columns:Array[2]
        0:"time"
        1:"sum"
      values:Array[73]
        0:Array[1530870900000,null]
        (...)
        37:Array[1530882000000,null]
        38:Array[1530882300000,8]
        39:Array[1530882600000,null]
        (...)
        44:Array[1530884100000,null]
        45:Array[1530884400000,2]
        46:Array[1530884700000,null]
        (...)
        53:Array[1530886800000,null]
        54:Array[1530887100000,2]
        55:Array[1530887400000,null]
        (...)
        72:Array[1530892500000,null]

Upvotes: 0

Views: 3342

Answers (1)

Kasper Grubbe
Kasper Grubbe

Reputation: 943

I figured out that the singlestat panel defaults to Average instead of Total (which I expected to be default).

enter image description here

Upvotes: 5

Related Questions