Plugins: Remove support for deprecated backend plugin protocol version (#34127)

* 33959: Remove support for deprecated backend plugin protocol (v1)

* 33959: Remove unused methods

* 33959: Remove some additional unused code

* 33959: Remove some additional unused code

* 33959: Remove datasource plugin wrapper with test

* 33959:Remove DefaultProtocolVersion
This commit is contained in:
idafurjes
2021-05-19 08:57:48 +02:00
committed by GitHub
parent 5042dc3b52
commit 1e8e7e34f1
10 changed files with 14 additions and 468 deletions

View File

@ -6,7 +6,6 @@ import (
"fmt"
"time"
pluginModel "github.com/grafana/grafana-plugin-model/go/renderer"
"github.com/grafana/grafana/pkg/plugins/backendplugin/pluginextensionv2"
)
@ -19,48 +18,6 @@ func (rs *RenderingService) renderViaPlugin(ctx context.Context, renderKey strin
ctx, cancel := context.WithTimeout(ctx, opts.Timeout+time.Second*2)
defer cancel()
if rs.pluginInfo.GrpcPluginV2 != nil {
return rs.renderViaPluginV2(ctx, renderKey, opts)
}
return rs.renderViaPluginV1(ctx, renderKey, opts)
}
func (rs *RenderingService) renderViaPluginV1(ctx context.Context, renderKey string, opts Opts) (*RenderResult, error) {
filePath, err := rs.getNewFilePath(RenderPNG)
if err != nil {
return nil, err
}
req := &pluginModel.RenderRequest{
Url: rs.getURL(opts.Path),
Width: int32(opts.Width),
Height: int32(opts.Height),
FilePath: filePath,
Timeout: int32(opts.Timeout.Seconds()),
RenderKey: renderKey,
Encoding: opts.Encoding,
Timezone: isoTimeOffsetToPosixTz(opts.Timezone),
Domain: rs.domain,
}
rs.log.Debug("calling renderer plugin", "req", req)
rsp, err := rs.pluginInfo.GrpcPluginV1.Render(ctx, req)
if errors.Is(ctx.Err(), context.DeadlineExceeded) {
rs.log.Info("Rendering timed out")
return nil, ErrTimeout
}
if err != nil {
return nil, err
}
if rsp.Error != "" {
return nil, fmt.Errorf("rendering failed: %v", rsp.Error)
}
return &RenderResult{FilePath: filePath}, nil
}
func (rs *RenderingService) renderViaPluginV2(ctx context.Context, renderKey string, opts Opts) (*RenderResult, error) {
filePath, err := rs.getNewFilePath(RenderPNG)
if err != nil {
return nil, err