grafana / grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
https://grafana.com
GNU Affero General Public License v3.0
64.58k stars 12.09k forks source link

StatusHistory: Panel frequently doesn't render in Grafana 9.0.1 #51259

Open siebenmann opened 2 years ago

siebenmann commented 2 years ago

What happened: I'm trying to use the (beta) Status History panel type to display the state of Prometheus alerts over time. Frequently the result doesn't render at all, although the information is available and other panel types will show the information.

What you expected to happen: The Status History shows data and that data matches the information shown by other ways to visualize this information.

How to reproduce it (as minimally and precisely as possible): Add a Status History panel with a Prometheus data source that has some alerts that have fired over the time range you're looking at. A suitable query is sum(max_over_time(ALERTS[$__interval])) by (alertname).

Anything else we need to know?:

Environment:

Develer commented 1 year ago

Unable to reproduce this issue.

Key Value
Panel status-history @ 10.1.0-pre (d183a241e9)
Grafana 10.1.0-pre (d183a241e9) // Open Source
Panel debug snapshot dashboard ```json { "panels": [ { "type": "status-history", "title": "Reproduced with embedded data", "gridPos": { "h": 13, "w": 15, "x": 0, "y": 0 }, "datasource": { "type": "grafana", "uid": "grafana" }, "id": 2, "targets": [ { "refId": "A", "datasource": { "type": "grafana", "uid": "grafana" }, "queryType": "snapshot", "snapshot": [ { "schema": { "refId": "A", "meta": { "type": "timeseries-multi", "typeVersion": [ 0, 1 ], "custom": { "resultType": "matrix" }, "executedQueryString": "Expr: histogram_quantile(.99, sum(rate(tns_request_duration_seconds_bucket{}[1m])) by (le))\nStep: 15s", "preferredVisualisationType": "graph" }, "fields": [ { "name": "Time", "type": "time", "typeInfo": { "frame": "time.Time" }, "config": { "interval": 15000 } }, { "name": "Value", "type": "number", "typeInfo": { "frame": "float64" }, "labels": {}, "config": { "displayNameFromDS": "histogram_quantile(.99, sum(rate(tns_request_duration_seconds_bucket{}[1m])) by (le))" } } ] }, "data": { "values": [ [ 1692634140000, 1692634155000, 1692634170000, 1692634185000, 1692634200000, 1692634215000, 1692634230000, 1692634245000, 1692634260000, 1692634275000, 1692634290000, 1692634305000, 1692634320000, 1692634335000, 1692634350000, 1692634365000, 1692634380000, 1692634395000, 1692634410000, 1692634425000, 1692634440000, 1692634455000, 1692634470000, 1692634485000, 1692634500000, 1692634515000, 1692634530000, 1692634545000, 1692634560000, 1692634575000, 1692634590000, 1692634605000, 1692634620000, 1692634635000, 1692634650000, 1692634665000, 1692634680000, 1692634695000, 1692634710000, 1692634725000, 1692634740000, 1692634755000, 1692634770000, 1692634785000, 1692634800000, 1692634815000, 1692634830000, 1692634845000, 1692634860000, 1692634875000, 1692634890000, 1692634905000, 1692634920000, 1692634935000, 1692634950000, 1692634965000, 1692634980000, 1692634995000, 1692635010000, 1692635025000, 1692635040000, 1692635055000, 1692635070000, 1692635085000, 1692635100000, 1692635115000, 1692635130000, 1692635145000, 1692635160000, 1692635175000, 1692635190000, 1692635205000, 1692635220000, 1692635235000, 1692635250000, 1692635265000, 1692635280000, 1692635295000, 1692635310000, 1692635325000, 1692635340000, 1692635355000, 1692635370000, 1692635385000, 1692635400000, 1692635415000, 1692635430000, 1692635445000, 1692635460000, 1692635475000, 1692635490000, 1692635505000, 1692635520000, 1692635535000, 1692635550000, 1692635565000, 1692635580000, 1692635595000, 1692635610000, 1692635625000, 1692635640000, 1692635655000, 1692635670000, 1692635685000, 1692635700000, 1692635715000, 1692635730000, 1692635745000, 1692635760000, 1692635775000, 1692635790000, 1692635805000, 1692635820000, 1692635835000, 1692635850000, 1692635865000, 1692635880000, 1692635895000, 1692635910000, 1692635925000, 1692635940000, 1692635955000, 1692635970000, 1692635985000, 1692636000000, 1692636015000, 1692636030000, 1692636045000, 1692636060000, 1692636075000, 1692636090000, 1692636105000, 1692636120000, 1692636135000, 1692636150000, 1692636165000, 1692636180000, 1692636195000, 1692636210000, 1692636225000, 1692636240000, 1692636255000, 1692636270000, 1692636285000, 1692636300000, 1692636315000, 1692636330000, 1692636345000, 1692636360000, 1692636375000, 1692636390000, 1692636405000, 1692636420000, 1692636435000, 1692636450000, 1692636465000, 1692636480000, 1692636495000, 1692636510000, 1692636525000, 1692636540000, 1692636555000, 1692636570000, 1692636585000, 1692636600000, 1692636615000, 1692636630000, 1692636645000, 1692636660000, 1692636675000, 1692636690000, 1692636705000, 1692636720000, 1692636735000, 1692636750000, 1692636765000, 1692636780000, 1692636795000, 1692636810000, 1692636825000, 1692636840000, 1692636855000, 1692636870000, 1692636885000, 1692636900000, 1692636915000, 1692636930000, 1692636945000, 1692636960000, 1692636975000, 1692636990000, 1692637005000, 1692637020000, 1692637035000, 1692637050000, 1692637065000, 1692637080000, 1692637095000, 1692637110000, 1692637125000, 1692637140000, 1692637155000, 1692637170000, 1692637185000, 1692637200000, 1692637215000, 1692637230000, 1692637245000, 1692637260000, 1692637275000, 1692637290000, 1692637305000, 1692637320000, 1692637335000, 1692637350000, 1692637365000, 1692637380000, 1692637395000, 1692637410000, 1692637425000, 1692637440000, 1692637455000, 1692637470000, 1692637485000, 1692637500000, 1692637515000, 1692637530000, 1692637545000, 1692637560000, 1692637575000, 1692637590000, 1692637605000, 1692637620000, 1692637635000, 1692637650000, 1692637665000, 1692637680000, 1692637695000, 1692637710000, 1692637725000, 1692637740000 ], [ 0.024395656666865398, 0.024307143029482232, 0.02432947648347541, 0.024319775556339233, 0.024400008187404003, 0.09500931404923621, 0.21618490858339806, 0.23319663146067401, 0.23182139366876137, 0.2143487427595617, 0.024385576923076916, 0.02446500165287298, 0.02443052303090023, 0.024376861699045172, 0.024310705838248983, 0.02426999086174723, 0.024303685681740683, 0.0242602678631435, 0.02435206210300797, 0.02453866623573176, 0.02455742593770571, 0.02456347285416275, 0.024443334012772138, 0.024446673102343792, 0.024342503203376446, 0.09728846217945865, 0.21582618311144453, 0.2303291164555273, 0.22821823205015737, 0.2015452160433558, 0.024291150607337535, 0.02431300172876598, 0.024302681892224055, 0.024316514343039324, 0.024337583337293724, 0.02442654332605121, 0.0243960841883529, 0.02449071331783339, 0.024429318042154927, 0.024446753479538407, 0.024339741792884735, 0.024318542033500652, 0.024316819640171846, 0.02426797193493873, 0.02429505984899402, 0.09718333444441989, 0.22299999285634894, 0.22984004569317884, 0.22734549865723477, 0.16757868273810167, 0.02433368503474287, 0.024320339194729163, 0.02434161677918472, 0.024341055785856082, 0.024314796961877296, 0.024295594807521453, 0.024389794767890743, 0.02440435696975185, 0.02437499257311416, 0.02427055576177249, 0.024308861810203086, 0.024288207193848853, 0.02432568478873174, 0.024305156787797016, 0.024332244224818077, 0.1543760353817383, 0.2233158559254698, 0.23374195930241046, 0.22995453553689954, 0.20587500138890452, 0.024415422082884077, 0.024337103926898557, 0.024269594549548554, 0.024362492445002423, 0.024398723418560444, 0.024434446771250295, 0.024364360985424913, 0.024312179442011396, 0.02432182670326127, 0.02435087763357599, 0.02439041082599373, 0.024380647421097086, 0.024337994911625773, 0.024282415329831223, 0.02427542691041184, 0.16213156315719338, 0.22925658157883028, 0.23670339067794732, 0.23413636464646453, 0.21232142857142855, 0.02426796491434189, 0.024250016132085616, 0.024260497847927706, 0.02428749982954919, 0.024312382055110306, 0.02430419285196688, 0.024305333381665763, 0.02425773841698464, 0.02427754665697738, 0.024278066402567525, 0.0243123451633447, 0.02432433668822316, 0.024305293458102287, 0.024322413793103445, 0.02428947368421052, 0.15799864817342843, 0.22778392523813945, 0.23702872214967063, 0.23501445045380698, 0.21728126180555526, 0.024351583297180162, 0.0245506771075921, 0.024580519480519484, 0.02459660309740726, 0.024438888888888885, 0.024327601578213516, 0.024258847467547983, 0.024233401295509927, 0.024270270270270265, 0.024330741430434604, 0.024319328177064874, 0.024339340974305575, 0.02428421512862196, 0.024310890957600396, 0.02429247358760564, 0.09470416365455371, 0.22571887499878476, 0.2368177783034175, 0.23604863304890422, 0.22022222654315524, 0.024292462629815555, 0.02430449522431652, 0.024303009630142078, 0.02434472892837516, 0.024347775564334692, 0.024397989204318748, 0.024414755370317297, 0.02436812444121136, 0.024314069346024307, 0.024318477828394896, 0.024502862265873154, 0.024571137883267615, 0.02453610483351265, 0.02445770701474672, 0.024404492638686714, 0.15752941764692716, 0.2237104479828177, 0.23463272419847558, 0.2318332888897668, 0.21242680483837634, 0.024555024058817862, 0.024541735874959447, 0.0244549347346966, 0.02435573472834067, 0.024413259080442735, 0.02461708197125747, 0.02467442400433313, 0.024614407370761437, 0.02432500818254056, 0.024353694454858858, 0.024417360963937835, 0.024407670427818044, 0.024435286209920717, 0.024350458455960976, 0.024376189095868635, 0.12723076153812046, 0.22008652884508537, 0.22975020130934296, 0.2257143493824528, 0.1854373859948824, 0.02432888193599511, 0.02440712683975979, 0.02433848723502303, 0.02439653621723082, 0.024317050738958484, 0.024398633747879317, 0.024349768655142625, 0.024430276066220415, 0.02450068503784085, 0.024614814028579315, 0.024579545545609587, 0.024406042723203562, 0.024378781684774937, 0.02440547130962419, 0.024430778433205926, 0.131177053041464, 0.2183555592634743, 0.23138953488372094, 0.22839593724228502, 0.20442645931279396, 0.024322873252174224, 0.024477197533460386, 0.024595454303669023, 0.02459673358871761, 0.024461533326812994, 0.024491080845092272, 0.0246980190751161, 0.024614100626336306, 0.024540653401104527, 0.024364689083075517, 0.02449058226030973, 0.0244171641644187, 0.024440508555843496, 0.02432218620973752, 0.0242813604616274, 0.09747283015372342, 0.2231272060908201, 0.23325271694535774, 0.23163847309903812, 0.20223434339155422, 0.024429651074336988, 0.02449471954049406, 0.02442151383041537, 0.02445206985945456, 0.024381072291830258, 0.02437130450384712, 0.024454839323966672, 0.024442226860569766, 0.024482731032954876, 0.024364613422951334, 0.024379701837631416, 0.024322406610849317, 0.024328820917038075, 0.02432434741614918, 0.024399375431936904, 0.10517657343777534, 0.23107149064460253, 0.2368151638230144, 0.23526388241578136, 0.205128538692628, 0.024316142850488588, 0.02434490051282051, 0.024383266488095235, 0.024370562819727926, 0.02436660625180674, 0.024449343521507336, 0.024422582375368738, 0.024424441943455038, 0.024425124017299016, 0.024456875833381794, 0.02445329403092193 ] ] } } ] } ], "options": { "showValue": "auto", "rowHeight": 0.9, "colWidth": 0.9, "legend": { "showLegend": true, "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "single", "sort": "none" } }, "fieldConfig": { "defaults": { "custom": { "lineWidth": 1, "fillOpacity": 70, "hideFrom": { "tooltip": false, "viz": false, "legend": false } }, "color": { "mode": "thresholds" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "value": null, "color": "green" }, { "value": 80, "color": "red" } ] } }, "overrides": [] } }, { "gridPos": { "h": 7, "w": 9, "x": 15, "y": 0 }, "id": 5, "options": { "content": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Panelstatus-history @ 10.1.0-pre (d183a241e9)
QueriesA[prometheus]
Data 1 frames, 2 fields, 241 rows
Grafana10.1.0-pre (d183a241e9) // Open Source
", "mode": "html" }, "title": "Debug info", "type": "text" }, { "id": 6, "title": "Original Panel JSON", "type": "text", "gridPos": { "h": 13, "w": 9, "x": 15, "y": 7 }, "options": { "content": "{\n \"type\": \"status-history\",\n \"title\": \"Panel Title\",\n \"gridPos\": {\n \"x\": 0,\n \"y\": 0,\n \"w\": 12,\n \"h\": 8\n },\n \"datasource\": {\n \"uid\": \"gdev-prometheus\",\n \"type\": \"prometheus\"\n },\n \"id\": 8,\n \"targets\": [\n {\n \"datasource\": {\n \"type\": \"prometheus\",\n \"uid\": \"gdev-prometheus\"\n },\n \"refId\": \"A\",\n \"expr\": \"histogram_quantile(.99, sum(rate(tns_request_duration_seconds_bucket{}[1m])) by (le))\",\n \"range\": true,\n \"instant\": false,\n \"editorMode\": \"code\",\n \"legendFormat\": \"__auto\"\n }\n ],\n \"options\": {\n \"showValue\": \"auto\",\n \"rowHeight\": 0.9,\n \"colWidth\": 0.9,\n \"legend\": {\n \"showLegend\": true,\n \"displayMode\": \"list\",\n \"placement\": \"bottom\"\n },\n \"tooltip\": {\n \"mode\": \"single\",\n \"sort\": \"none\"\n }\n },\n \"fieldConfig\": {\n \"defaults\": {\n \"custom\": {\n \"lineWidth\": 1,\n \"fillOpacity\": 70,\n \"hideFrom\": {\n \"tooltip\": false,\n \"viz\": false,\n \"legend\": false\n }\n },\n \"color\": {\n \"mode\": \"thresholds\"\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"value\": null,\n \"color\": \"green\"\n },\n {\n \"value\": 80,\n \"color\": \"red\"\n }\n ]\n }\n },\n \"overrides\": []\n }\n}", "mode": "code", "code": { "language": "json", "showLineNumbers": true, "showMiniMap": true } } }, { "id": 3, "title": "Data from panel above", "type": "table", "datasource": { "type": "datasource", "uid": "-- Dashboard --" }, "gridPos": { "h": 7, "w": 15, "x": 0, "y": 13 }, "options": { "showTypeIcons": true }, "targets": [ { "datasource": { "type": "datasource", "uid": "-- Dashboard --" }, "panelId": 2, "withTransforms": true, "refId": "A" } ] } ], "schemaVersion": 37, "title": "Debug: Panel Title // 2023-08-21 19:09:25", "tags": [ "debug", "debug-status-history" ], "time": { "from": "2023-08-21T16:09:25.698Z", "to": "2023-08-21T17:09:25.698Z" } } ```
xforman2 commented 7 months ago

Hi, @Develer this issue still persists. Here is a showcase url http://beta.fi.muni.cz:3000/a/xforman2-servermonitoring-app/drive Try to select Last 24 hours in Time Range and data are not rendered. Then try Last 2 days and you can see that there is timestamp within 24 hours

Last 24 hours: image Last 2 days: image

leeoniya commented 7 months ago

might be an issue with rendering a single timestamp?

the viz normally gets the width of the blocks by taking the delta between adjacent timestamps and multiplying by width factor. not really possible with one timestamp :)

we probably need a fallback derived from dashboard time range and some static block count, maybe 30-ish.

xforman2 commented 6 months ago

@leeoniya, I looked into it for a bit and there is one more calculation that occurs sooner. That is the calculation of xRange. It also uses a similar procedure, taking the delta between the first two timestamps, when calculating the min and max values. As there is just one value, undefined values are returned. This causes other undefined values when calculating the width of blocks.

Now regarding the fix: I would like to fix this issue but I do not want to break anything important. Is it possible to get some max width value? If yes, would it be sufficient to check if there is just one timestamp and set the block width to the maximum value?