How to query datasource plugin from panel plugin

Hi,

I have built a grafana datasource plugin similar to simple-json-backend-datasource plugin example and the data is getting fetched into the Grafana builtin table panel. Now I want to query this datasource in order to get data inside my own panel plugin which I have to build yet. But I don’t know how can I query the data from my panel plugin. I tried looking for some sort of documentation on it but couldn’t find any. Also I checked the ‘Query (options)’ function from frontend script of backend-datasource plugin, however, seems like the options parameter is quite long and I am not sure how to create it. It will be good to know which fields are mandatory and which aren’t. Is there some documentation one could refer to me or explain how the request needs to be made to the DS?

P.S: Though there is a small part on request format under simple-json-backend-datasource documentation but I’m unable to understand how the request should be generated from panel plugin and which fields are mandatory for a table response and which are optional.

2 Likes

In case someone else is looking for the answer too:
Apparently, the datasource can be added from the panel. The query to datasource is made automatically as the panel loads. In custom panel typescript, I can get the datasource response in props. In my case it was as simple as this.