How to get write permission to prometheus with app plugin in a Grafana Cloud env

Hi everyone!
I’m developing an app plugin for Grafana that includes a backend component. This backend fetches data from an external API and writes metrics to a Prometheus datasource. However, I’ve encountered a limitation with the Grafana plugin SDK for Go: it doesn’t provide access to the selected datasource credentials for writing metrics unless the user manually enters them in the plugin configuration.
Ideally, I’d like to simplify the user experience so that users can select a datasource using DataSourcePicker UI component without needing to manually input credentials(Grafana Cloud API token and instance ID for remote write endpoint).
I’d like to know if it’s possible to achieve a level of integration for third party plugins. If so, I’d greatly appreciate any guidance or documentation on how to accomplish this.
Thanks in advance!

Hi @gucci
if you mean you want to get from a plugin’s backend the credentials of a datasource (other than the same plugin): you can’t. there’s no way to do that and that’s by design.

your best bet is build a configuration page for your plugin where the user will have to input (a second time) the prometheus information (endpoint, auth details).

there’s no way around this.

1 Like

Thank you for your reply! Does this design apply universally to all plugins, or do official ones(such as Synthetic Monitoring) have certain advantages?

they all work with these limitations. what often plugins do is allow the user to “select a datasource” and then they query the datasource directly.

But data sources are for fetching data not for pushing data.

1 Like