App plugin with backend, and nested datasource plugin

Hello, I’m trying to develop a an app plugin that is supposed to have a backend (for a later API), but I also want to have streaming using a nested datasource plugin, I want the nested datasource to use the App’s backend for streaming (I only want one backend because later on I will have another nested panel plugin that uses that same backend)

The issue is, I don’t know what uid to use for the query method in the nested datasource, same for getResource (how to make that use the app backend?)

Could someone kindly give me an example of how would that work in code? Thanks.

Hi @kateonbxsh in that case you allow the user to select the datasource in your app configuration page.

you can use the DatasourcePicker compoonent from @grafana/runtime for that.

thanks for the reply. how would that allow the datasource to use the App backend for API calls and streaming?

Ah! I misunderstood. I thought you wanted from the app call the datasource.

you don’t need the app uid just the plugin id. see Fetch data from frontend code using the data proxy | Grafana Plugin Tools