grafana / scenes

Build Grafana dashboards directly in your Grafana app plugins.
https://grafana.com/developers/scenes
Apache License 2.0
133 stars 20 forks source link

Two concurrent SceneQueryRunners lead to aborted requests #739

Closed kmaharshi213 closed 3 months ago

kmaharshi213 commented 4 months ago

Hello! I am seeing the following error when running my scenes app:

{"type":"cancelled","cancelled":true,"data":null,
"status":-1,
"statusText":"Request was aborted",
"config":{"method":"POST","url":"<source url>",
"data":"target=<query string>&from=1715367315&until=1715370917&format=json&maxDataPoints=500",
"headers":{"Content-Type":"application/x-www-form-urlencoded","X-Panel-Id":1,"X-Grafana-Org-Id":1},
"requestId":"metrictank.panelId.1",
"inspect":{"type":"graphite"},"retry":0,"hideFromInspector":false}}

I have two query runners like so:

const qr1 = new SceneQueryRunner({
        datasource: DATASOURCE_REFERENCE,
        queries: [
            {
                refId: 'A',
                target: "seriesByTag('namespace=<name>, 'name=<name1>')"
            }
        ]});
const qr2= new SceneQueryRunner({
        datasource: DATASOURCE_REFERENCE,
        queries: [
            {
                refId: 'B',
                target: "seriesByTag('namespace=<name>, 'name=<name2>')"
            }
        ]});

And I render an EmbeddedScene - snippet below:

children: 
[
      new SceneGridItem({
          x: 0,
          y: 0,
          width: 10,
          height: 5,
          body: PanelBuilders.timeseries().setData(qr1).setTitle('Query 1').build()
      }),
      new SceneGridItem({
          x: 12,
          y: 0,
          width: 10,
          height: 5,
          body: PanelBuilders.timeseries().setData(qr2).setTitle('Query 2').build()
      }),
]

Note that I am querying a metrictank instance. Typical Grafana panels query the same instance, and of course multiple panels work just fine. ONE of the panels (usually the one for qr1) does not render and spits out the error shown above. The other panel renders fine. If I paste the same query in both of them, it does work.

Any insight would be helpful. Not sure why concurrent queries to the same datasource would be a problem.