Datasource concurency issue in dashboard with multiple panels

Hi,

I’m currently working on a simple custom datasource which compute calculations, and that’s not the first Grafana datasource which I worked on.

I won’t share my datasource’s code because the problem seems to come from it, but I need some assistance on Grafana datasource’s comprehension, I suspect some kind of concurency isses between multiple queries at the same moment.

My custom datasource actually works and I can integrate it into panels without issues, but when I use it in multiple panels in the same Grafana dashboard, some of the panel end up with errors from my datasource (despite having no issues when focusing on the panel with the v or using it in a dashboard with only 1 or 2 panels, but only when the dashboard display multiple panels in the same views).
The more panels using my custom data source are displayed in the dashboard, the more likely they are to generate errors.

What my custom datasource compute is eval/expr, so it need to compute the expression sorted in a way in order to handle parenthesis & co, it works, but when in dashboard with multiple panels the query crash randomly with the error “An error occurred within the plugin” (despite all the possible error are being catched in my code).

So my question is: How does Grafana datasources handle query ? If a dashboard perform multiple queries on the same datasource with different parameters, If I don’t use pointers (it’s wrote using Go) or anything fancy but mere slices, queries won’t collide between each other or changes variable’s content across functions ? Did one of you already experimented this kind of situation ? I need to be reassured.

Best regards,

1 Like

issue could be the underlying data your datasource queries against.

for example many times users of grafana use a datasource plugin on a db that is not well indexed and.or normalized.

then they implement queries that filter on columns that are not indexed. so they post here with issues about performance.

after some guidance and some back and forth it is revealed the issue, though manifest in grafana, is not grafana itself. the issue just happened to be exposed in grafana.

1 Like

Alright, it may indeed be a performance issue, I’ll investigate this point.

Thanks for the quick reply !

1 Like