Fix deprecated methods based on instructions
This commit is contained in:
@@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/zabbix"
|
"github.com/alexanderzobnin/grafana-zabbix/pkg/zabbix"
|
||||||
|
|
||||||
|
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||||
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
|
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
|
||||||
"github.com/grafana/grafana-plugin-sdk-go/backend/resource/httpadapter"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Resource handler describes handlers for the resources populated by plugin in plugin.go, like:
|
// Resource handler describes handlers for the resources populated by plugin in plugin.go, like:
|
||||||
@@ -48,7 +48,7 @@ func (ds *ZabbixDatasource) ZabbixAPIHandler(rw http.ResponseWriter, req *http.R
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx := req.Context()
|
ctx := req.Context()
|
||||||
pluginCxt := httpadapter.PluginConfigFromContext(ctx)
|
pluginCxt := backend.PluginConfigFromContext(ctx)
|
||||||
dsInstance, err := ds.getDSInstance(ctx, pluginCxt)
|
dsInstance, err := ds.getDSInstance(ctx, pluginCxt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ds.logger.Error("Error loading datasource", "error", err)
|
ds.logger.Error("Error loading datasource", "error", err)
|
||||||
@@ -89,7 +89,7 @@ func (ds *ZabbixDatasource) DBConnectionPostProcessingHandler(rw http.ResponseWr
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx := req.Context()
|
ctx := req.Context()
|
||||||
pluginCxt := httpadapter.PluginConfigFromContext(ctx)
|
pluginCxt := backend.PluginConfigFromContext(ctx)
|
||||||
dsInstance, err := ds.getDSInstance(ctx, pluginCxt)
|
dsInstance, err := ds.getDSInstance(ctx, pluginCxt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ds.logger.Error("Error loading datasource", "error", err)
|
ds.logger.Error("Error loading datasource", "error", err)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func main() {
|
|||||||
|
|
||||||
pluginLogger.Debug("Starting Zabbix datasource")
|
pluginLogger.Debug("Starting Zabbix datasource")
|
||||||
|
|
||||||
err := backend.Serve(backend.ServeOpts{
|
err := backend.Manage(ZABBIX_PLUGIN_ID, backend.ServeOpts{
|
||||||
CallResourceHandler: httpResourceHandler,
|
CallResourceHandler: httpResourceHandler,
|
||||||
QueryDataHandler: ds,
|
QueryDataHandler: ds,
|
||||||
CheckHealthHandler: ds,
|
CheckHealthHandler: ds,
|
||||||
|
|||||||
Reference in New Issue
Block a user