mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 00:42:03 +08:00
Chore: Improve rendering logging (#21008)
Moving info log from phantomjs to rendering service so it's logged for all kinds of renderers. Add debug log for image renderer plugin and remote renderer.
This commit is contained in:

committed by
GitHub

parent
fe8b533497
commit
34236ca1ae
@ -3,11 +3,12 @@ package rendering
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
plugin "github.com/hashicorp/go-plugin"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
plugin "github.com/hashicorp/go-plugin"
|
||||
|
||||
pluginModel "github.com/grafana/grafana-plugin-model/go/renderer"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/middleware"
|
||||
@ -59,6 +60,7 @@ func (rs *RenderingService) Init() error {
|
||||
|
||||
func (rs *RenderingService) Run(ctx context.Context) error {
|
||||
if rs.Cfg.RendererUrl != "" {
|
||||
rs.log = rs.log.New("renderer", "http")
|
||||
rs.log.Info("Backend rendering via external http server")
|
||||
rs.renderAction = rs.renderViaHttp
|
||||
<-ctx.Done()
|
||||
@ -66,6 +68,7 @@ func (rs *RenderingService) Run(ctx context.Context) error {
|
||||
}
|
||||
|
||||
if plugins.Renderer == nil {
|
||||
rs.log = rs.log.New("renderer", "phantomJS")
|
||||
rs.log.Info("Backend rendering via phantomJS")
|
||||
rs.log.Warn("phantomJS is deprecated and will be removed in a future release. " +
|
||||
"You should consider migrating from phantomJS to grafana-image-renderer plugin.")
|
||||
@ -74,6 +77,7 @@ func (rs *RenderingService) Run(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
rs.log = rs.log.New("renderer", "plugin")
|
||||
rs.pluginInfo = plugins.Renderer
|
||||
|
||||
if err := rs.startPlugin(ctx); err != nil {
|
||||
@ -114,6 +118,7 @@ func (rs *RenderingService) Render(ctx context.Context, opts Opts) (*RenderResul
|
||||
rs.inProgressCount += 1
|
||||
|
||||
if rs.renderAction != nil {
|
||||
rs.log.Info("Rendering", "path", opts.Path)
|
||||
return rs.renderAction(ctx, opts)
|
||||
}
|
||||
return nil, fmt.Errorf("No renderer found")
|
||||
|
Reference in New Issue
Block a user