-
What Grafana version and what operating system are you using?
Grafana v8.1.2 , Linux ubuntu 20.04 -
What are you trying to achieve?
PlugIn development: Can I prebuild an influx query from the panel options with preset pull down menu items and have it populated to the data section raw queries? Is this possible? -
How are you trying to achieve it?
Not sure if this is possible with the framework. -
What happened?
Designing a new plugin for specific influx queries. -
What did you expect to happen?
-
Can you copy/paste the configuration(s) that you are having problems with?
-
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
-
Did you follow any online instructions? If so, what is the URL?
Following the plugin development instructions from the docs.
First off, since panels are designed to not depend on any specific data source, this is not a well supported use case. I think accessing the data source from your panel options is going to be tricky, and updating the query model would be even trickier.
That being said, here are a few tips that might help you (though I could also be leading you on a wild goose chase):
- You can access a specific data source instance by using the
getBackendSrv()
function to list all data sources. - Within the render method of a panel, you can get the id of the data source that was used for the specific query, but I’m not sure how you’d update the
jsonData
model with that approach. - If it’s a custom data source that you controlled, you could add a method on the data source instance, and then invoke it from the panel. For a built-in data source like InfluxDB, that’s likely not going to work though.
This topic was automatically closed after 365 days. New replies are no longer allowed.