Plugins: Make renderer service load renderer plugin (#77854)
* rendering service loads renderer plugin * update naming * tidy * apply PR feedback * fix missing feature manager * fix step * set plugin
This commit is contained in:
@@ -8,10 +8,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/plugins/backendplugin/pluginextensionv2"
|
||||
)
|
||||
|
||||
func (rs *RenderingService) startPlugin(ctx context.Context) error {
|
||||
return rs.pluginInfo.Start(ctx)
|
||||
}
|
||||
|
||||
func (rs *RenderingService) renderViaPlugin(ctx context.Context, renderKey string, opts Opts) (*RenderResult, error) {
|
||||
// gives plugin some additional time to timeout and return possible errors.
|
||||
ctx, cancel := context.WithTimeout(ctx, getRequestTimeout(opts.TimeoutOpts))
|
||||
@@ -45,7 +41,11 @@ func (rs *RenderingService) renderViaPlugin(ctx context.Context, renderKey strin
|
||||
}
|
||||
rs.log.Debug("Calling renderer plugin", "req", req)
|
||||
|
||||
rsp, err := rs.pluginInfo.Renderer.Render(ctx, req)
|
||||
rc, err := rs.plugin.Client()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rsp, err := rc.Render(ctx, req)
|
||||
if errors.Is(ctx.Err(), context.DeadlineExceeded) {
|
||||
rs.log.Info("Rendering timed out")
|
||||
return nil, ErrTimeout
|
||||
@@ -89,7 +89,12 @@ func (rs *RenderingService) renderCSVViaPlugin(ctx context.Context, renderKey st
|
||||
}
|
||||
rs.log.Debug("Calling renderer plugin", "req", req)
|
||||
|
||||
rsp, err := rs.pluginInfo.Renderer.RenderCSV(ctx, req)
|
||||
rc, err := rs.plugin.Client()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rsp, err := rc.RenderCSV(ctx, req)
|
||||
if err != nil {
|
||||
if errors.Is(ctx.Err(), context.DeadlineExceeded) {
|
||||
rs.log.Info("Rendering timed out")
|
||||
|
||||
Reference in New Issue
Block a user