grafana / incident-community

Public repository for Grafana Incident feedback, bug reports, discussions, and updates.
26 stars 2 forks source link

Embedded queries failing to load on refresh #16

Closed Bruno-DaSilva closed 2 years ago

Bruno-DaSilva commented 2 years ago

Describe the bug On load of an incident page, queries show as blank. Very occasionally they will render correctly. If you edit the query and save it, it renders correctly until you refresh again.

To Reproduce Steps to reproduce the behavior:

  1. Go to an incident with a created 'query'
  2. Scroll down to the query panel.
  3. Observe that the query panel shows "No data or query"

Expected behavior The query panel shows the saved query as a graph.

Screenshots

Screen Shot 2022-07-27 at 4 40 16 PM Screen Shot 2022-07-27 at 4 40 24 PM

Relevant system information Browser: Google Chrome 103.0.5060.134 Grafana: v9.0.5 (1b595e434) Incident: 1.0.0-beta29 Browser timezone: EDT (UTC-4) Organization timezone: America/Toronto (UTC-4)

Bruno-DaSilva commented 2 years ago

I took a look in my dev console to see what's going on. I notice that there are TWO /api/ds/query endpoint requests being sent out - one of them returns results and one of them does not. If the zero-result query fails then the panel renders, if it succeeds then it shows no data.

The two requests are identical except for the payload:

FAILING/NO RESULTS

{
    "queries": [
        {
            "refId": "A",
            "expr": "sum by (queue) (avg_over_time(rabbitmq_queue_messages{queue=~\"...\"}[5m:]))",
            "editorMode": "code",
            "range": true,
            "legendFormat": "__auto",
            "datasource": {
                "uid": "vSyGdhP7z",
                "type": "prometheus"
            },
            "queryType": "timeSeriesQuery",
            "exemplar": false,
            "requestId": "undefinedA",
            "utcOffsetSec": -14400,
            "interval": "",
            "datasourceId": 30,
            "intervalMs": 31536000000,
            "maxDataPoints": 0
        }
    ],
    "range": {
        "from": "2022-07-27T12:00:00.000Z",
        "to": "2022-07-27T20:45:59.000Z",
        "raw": {
            "from": "2022-07-27T12:00:00.000Z",
            "to": "2022-07-27T20:45:59.000Z"
        }
    },
    "from": "1658923200000",
    "to": "1658954759000"
}
Screen Shot 2022-07-27 at 4 46 02 PM

SUCCESSFUL

{
    "queries": [
        {
            "refId": "A",
            "expr": "sum by (queue) (avg_over_time(rabbitmq_queue_messages{queue=~\"...\"}[5m:]))",
            "editorMode": "code",
            "range": true,
            "legendFormat": "__auto",
            "datasource": {
                "uid": "vSyGdhP7z",
                "type": "prometheus"
            },
            "queryType": "timeSeriesQuery",
            "exemplar": false,
            "requestId": "undefinedA",
            "utcOffsetSec": -14400,
            "interval": "",
            "datasourceId": 30,
            "intervalMs": 30000,
            "maxDataPoints": 809
        }
    ],
    "range": {
        "from": "2022-07-27T12:00:00.000Z",
        "to": "2022-07-27T20:45:59.000Z",
        "raw": {
            "from": "2022-07-27T12:00:00.000Z",
            "to": "2022-07-27T20:45:59.000Z"
        }
    },
    "from": "1658923200000",
    "to": "1658954759000"
}
Screen Shot 2022-07-27 at 4 46 12 PM
Bruno-DaSilva commented 2 years ago

And here's an example of the no data query failing and the panel rendering

Screen Shot 2022-07-27 at 4 10 47 PM Screen Shot 2022-07-27 at 4 08 50 PM
devinrcheevers commented 2 years ago

Thanks for a great bug report, we'll look into this!

matryer commented 2 years ago

@Bruno-DaSilva What a great report, thank you so much. We'll take a look and see if we can figure out what's going on here. cc @idk-92

idk-92 commented 2 years ago

@Bruno-DaSilva Thanks for the awesome write up! This should be resolved with the next release.

idk-92 commented 2 years ago

@Bruno-DaSilva if you don't mind closing out this issue if things look good on your end!

Bruno-DaSilva commented 2 years ago

Can confirm, looks like it's working. Thanks all!