grafana / tutorials

A series of tutorials for helping you make the most out of Grafana.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No description of how to access data source options from GOLANG in backend sources

OptrixAU opened this issue · comments

The documentation clearly shows how to set up the web UI for both the data source configuration and queries, but at no point does it show how to actually access those options in your backend data source.

It's probably quite simple, but since I'm not very familiar with GO I'm more or less bashing my head into the wall.

I can see that in the CheckHealth call they appear to be hidden somewhere in req.PluginContext.DataSourceInstanceSettings.JSONData, but it's then wrapped in a RawJSON object that for some reason won't parse with json.Unmarshal.

Is there a simple example you could provide showing that - if you enter a host name in your data source configuration - you can ACCESS that information in your CheckHealth or Query functions?