You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm develop an Grafana App and I have no clue, what happens, if the user updates the settings at admin panel. I guess, the setting will be saved on Grafana side, but not propagated to the plugin.
Having if a interface where implement I can implement a configReload function, would be great.
_ backend.ConfigReloadHandler = (*App)(nil)
I the code, I can see a NeedsUpdate function, no clue what it does.
if the user updates the settings at admin panel. I guess, the setting will be saved on Grafana side, but not propagated to the plugin.
Where are you storing settings? Inside jsonData / secureJsonData? Please see below which shows a demonstration of the instance factory function (NewApp), which is invoked when settings are changed.
package plugin
// NewApp creates a new example *App instance. This function will be invoked every time there is an update // to the `Updated` timestamp of the `AppInstanceSettings` (controlled by Grafana)funcNewApp(_ context.Context, _ backend.AppInstanceSettings) (instancemgmt.Instance, error) {
varappAppmux:=http.NewServeMux()
app.registerRoutes(mux)
app.CallResourceHandler=httpadapter.New(mux)
return&app, nil
}
// Dispose here tells plugin SDK that plugin wants to clean up resources when a new instance// created.func (a*App) Dispose() {
// cleanup
}
// CheckHealth handles health checks sent from Grafana to the plugin.func (a*App) CheckHealth(_ context.Context, _*backend.CheckHealthRequest) (*backend.CheckHealthResult, error) {
return&backend.CheckHealthResult{
Status: backend.HealthStatusOk,
Message: "ok",
}, nil
}
What would you like to be added:
I'm develop an Grafana App and I have no clue, what happens, if the user updates the settings at admin panel. I guess, the setting will be saved on Grafana side, but not propagated to the plugin.
Having if a interface where implement I can implement a configReload function, would be great.
I the code, I can see a NeedsUpdate function, no clue what it does.
grafana-plugin-sdk-go/backend/app/instance_provider.go
Line 61 in aac004c
Why is this needed:
Reading the https://grafana.com/developers/plugin-tools/key-concepts/backend-plugins/#caching-and-connection-pooling It's recommend to setup the client on init and re-use it every time.
But, if settings are updated by admin, I have to re-create some clients on reload.
The text was updated successfully, but these errors were encountered: