Using query results as a select option to generate new query for my backend datasource plugin

Hi, I am trying to create a datasource backend plugin and I want to generate query with multiple steps for my datasource which is being connected using go lang in backend.
The steps are:

  1. First query will be to get distinct types of metrics and show it in options in the query
  2. Second will be, if user select one option from it will get the data on UI.

I was able to get data on UI where graph are shown using dataframes, but i want the first query to return some data in frontend as select options format.
What can i do for it?
As i found out that if i add a variable(array) in my query and want to append data into it in backend it is not being updated in frontend, so that remains empty for me.
Like the frontend variables can be passed to backend using getTemplateSrv, is there any way to do vice versa of it.
Please help.


I have a similar problem for now, can you show what you already got please, i think it might help me.

Thanks’ in advance


Using panelData properties i am able to get those values now by adding them as frames in backend and accessing them in queryeditor using this data?.series.values().next().value.fields[0].values
I am not sure if it is acceptable.
But the data is also showing on the grafana ui where all graphs are shown and i want this to be populated only in my dropdown. Also asyncselect is not working as i want it to, it does not populate the values at first at all. I want it to go for loadoptions only when i click on it and should refresh the options with each click.
Hope any info helped you. But i am a bit stuck on two things( do not want to show on graph section and want to work async select as my choice).

Thank you

Thank you that’s help me a little, if i found how to do it i will tell you.


1 Like