From 7c0fc59dfbd88ff74fb13327a81ae7bcc1be76d0 Mon Sep 17 00:00:00 2001 From: bergquist Date: Wed, 13 Dec 2017 17:58:50 +0100 Subject: [PATCH] execute process directly instead of creating sub shell --- pkg/plugins/backend_datasource.go | 14 ++++++++------ pkg/tsdb/models/proxy/wrapper.go | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pkg/plugins/backend_datasource.go b/pkg/plugins/backend_datasource.go index 51f1a118a14..0e5eaa34243 100644 --- a/pkg/plugins/backend_datasource.go +++ b/pkg/plugins/backend_datasource.go @@ -24,17 +24,19 @@ type BackendDatasource struct { client *plugin.Client } +var handshakeConfig = plugin.HandshakeConfig{ + ProtocolVersion: 1, + MagicCookieKey: "GRAFANA_BACKEND_DATASOURCE", + MagicCookieValue: "55d2200a-6492-493a-9353-73b728d468aa", +} + func (p *BackendDatasource) initBackendPlugin(log log.Logger) error { p.log = log.New("plugin-id", p.Id) p.client = plugin.NewClient(&plugin.ClientConfig{ - HandshakeConfig: plugin.HandshakeConfig{ - ProtocolVersion: 1, - MagicCookieKey: "BASIC_PLUGIN", - MagicCookieValue: "hello", - }, + HandshakeConfig: handshakeConfig, Plugins: map[string]plugin.Plugin{p.Id: &shared.TsdbPluginImpl{}}, - Cmd: exec.Command("sh", "-c", path.Join(p.PluginDir, p.Executable)), + Cmd: exec.Command(path.Join(p.PluginDir, p.Executable)), AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC}, Logger: backend.LogWrapper{Logger: p.log}, }) diff --git a/pkg/tsdb/models/proxy/wrapper.go b/pkg/tsdb/models/proxy/wrapper.go index 899b65a1478..b6c9611024b 100644 --- a/pkg/tsdb/models/proxy/wrapper.go +++ b/pkg/tsdb/models/proxy/wrapper.go @@ -64,6 +64,7 @@ func (tw *TsdbWrapper) Query(ctx context.Context, ds *models.DataSource, query * res := &tsdb.Response{ Message: pbres.Message, + Results: map[string]*tsdb.QueryResult{}, } for _, r := range pbres.Results {