mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
By storing render key in remote cache it will enable image renderer to use public facing url or load balancer url to render images and thereby remove the requirement of image renderer having to use the url of the originating Grafana instance when running HA setup (multiple Grafana instances). Fixes #17704 Ref grafana/grafana-image-renderer#91
39 lines
990 B
Go
39 lines
990 B
Go
package rendering
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
|
|
"github.com/grafana/grafana/pkg/models"
|
|
)
|
|
|
|
var ErrTimeout = errors.New("Timeout error. You can set timeout in seconds with &timeout url parameter")
|
|
var ErrNoRenderer = errors.New("No renderer plugin found nor is an external render server configured")
|
|
var ErrPhantomJSNotInstalled = errors.New("PhantomJS executable not found")
|
|
|
|
type Opts struct {
|
|
Width int
|
|
Height int
|
|
Timeout time.Duration
|
|
OrgId int64
|
|
UserId int64
|
|
OrgRole models.RoleType
|
|
Path string
|
|
Encoding string
|
|
Timezone string
|
|
ConcurrentLimit int
|
|
}
|
|
|
|
type RenderResult struct {
|
|
FilePath string
|
|
}
|
|
|
|
type renderFunc func(ctx context.Context, renderKey string, options Opts) (*RenderResult, error)
|
|
|
|
type Service interface {
|
|
Render(ctx context.Context, opts Opts) (*RenderResult, error)
|
|
RenderErrorImage(error error) (*RenderResult, error)
|
|
GetRenderUser(key string) (*RenderUser, bool)
|
|
}
|