Rendering: Add configuration options for renderKey lifetime (#57339)
* Add configuration options for `renderKey` lifetime * Rename config key to `render_key_lifetime` * Update conf/defaults.ini Co-authored-by: Joan López de la Franca Beltran <5459617+joanlopez@users.noreply.github.com> * Add `render_key_lifetime` to sample.ini Co-authored-by: Joan López de la Franca Beltran <5459617+joanlopez@users.noreply.github.com>
This commit is contained in:
co-authored by
Joan López de la Franca Beltran
parent
90ac300d10
commit
e9dc7fb85c
@@ -1134,6 +1134,11 @@ renderer_token = -
|
|||||||
# Concurrent render request limit affects when the /render HTTP endpoint is used. Rendering many images at the same time can overload the server,
|
# Concurrent render request limit affects when the /render HTTP endpoint is used. Rendering many images at the same time can overload the server,
|
||||||
# which this setting can help protect against by only allowing a certain amount of concurrent requests.
|
# which this setting can help protect against by only allowing a certain amount of concurrent requests.
|
||||||
concurrent_render_request_limit = 30
|
concurrent_render_request_limit = 30
|
||||||
|
# Determines the lifetime of the render key used by the image renderer to access and render Grafana.
|
||||||
|
# This setting should be expressed as a duration. Examples: 10s (seconds), 5m (minutes), 2h (hours).
|
||||||
|
# Default is 5m. This should be more than enough for most deployments.
|
||||||
|
# Change the value only if image rendering is failing and you see `Failed to get the render key from cache` in Grafana logs.
|
||||||
|
render_key_lifetime = 5m
|
||||||
|
|
||||||
[panels]
|
[panels]
|
||||||
# here for to support old env variables, can remove after a few months
|
# here for to support old env variables, can remove after a few months
|
||||||
|
|||||||
+6
-1
@@ -1099,6 +1099,11 @@
|
|||||||
# Concurrent render request limit affects when the /render HTTP endpoint is used. Rendering many images at the same time can overload the server,
|
# Concurrent render request limit affects when the /render HTTP endpoint is used. Rendering many images at the same time can overload the server,
|
||||||
# which this setting can help protect against by only allowing a certain amount of concurrent requests.
|
# which this setting can help protect against by only allowing a certain amount of concurrent requests.
|
||||||
;concurrent_render_request_limit = 30
|
;concurrent_render_request_limit = 30
|
||||||
|
# Determines the lifetime of the render key used by the image renderer to access and render Grafana.
|
||||||
|
# This setting should be expressed as a duration. Examples: 10s (seconds), 5m (minutes), 2h (hours).
|
||||||
|
# Default is 5m. This should be more than enough for most deployments.
|
||||||
|
# Change the value only if image rendering is failing and you see `Failed to get the render key from cache` in Grafana logs.
|
||||||
|
;render_key_lifetime = 5m
|
||||||
|
|
||||||
[panels]
|
[panels]
|
||||||
# If set to true Grafana will allow script tags in text panels. Not recommended as it enable XSS vulnerabilities.
|
# If set to true Grafana will allow script tags in text panels. Not recommended as it enable XSS vulnerabilities.
|
||||||
@@ -1260,4 +1265,4 @@
|
|||||||
# Move a specific app plugin page (referenced by its `path` field) to a specific navigation section
|
# Move a specific app plugin page (referenced by its `path` field) to a specific navigation section
|
||||||
[navigation.app_standalone_pages]
|
[navigation.app_standalone_pages]
|
||||||
# The following will move the page with the path "/a/my-app-id/starred-content" from `my-app-id` to the `starred` section
|
# The following will move the page with the path "/a/my-app-id/starred-content" from `my-app-id` to the `starred` section
|
||||||
# /a/my-app-id/starred-content = starred
|
# /a/my-app-id/starred-content = starred
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ func ProvideService(cfg *setting.Cfg, remoteCache *remotecache.RemoteCache, rm p
|
|||||||
perRequestRenderKeyProvider: &perRequestRenderKeyProvider{
|
perRequestRenderKeyProvider: &perRequestRenderKeyProvider{
|
||||||
cache: remoteCache,
|
cache: remoteCache,
|
||||||
log: logger,
|
log: logger,
|
||||||
keyExpiry: 5 * time.Minute,
|
keyExpiry: cfg.RendererRenderKeyLifeTime,
|
||||||
},
|
},
|
||||||
capabilities: []Capability{
|
capabilities: []Capability{
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -247,6 +247,7 @@ type Cfg struct {
|
|||||||
RendererCallbackUrl string
|
RendererCallbackUrl string
|
||||||
RendererAuthToken string
|
RendererAuthToken string
|
||||||
RendererConcurrentRequestLimit int
|
RendererConcurrentRequestLimit int
|
||||||
|
RendererRenderKeyLifeTime time.Duration
|
||||||
|
|
||||||
// Security
|
// Security
|
||||||
DisableInitAdminCreation bool
|
DisableInitAdminCreation bool
|
||||||
@@ -1486,6 +1487,7 @@ func (cfg *Cfg) readRenderingSettings(iniFile *ini.File) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cfg.RendererConcurrentRequestLimit = renderSec.Key("concurrent_render_request_limit").MustInt(30)
|
cfg.RendererConcurrentRequestLimit = renderSec.Key("concurrent_render_request_limit").MustInt(30)
|
||||||
|
cfg.RendererRenderKeyLifeTime = renderSec.Key("render_key_lifetime").MustDuration(5 * time.Minute)
|
||||||
cfg.ImagesDir = filepath.Join(cfg.DataPath, "png")
|
cfg.ImagesDir = filepath.Join(cfg.DataPath, "png")
|
||||||
cfg.CSVsDir = filepath.Join(cfg.DataPath, "csv")
|
cfg.CSVsDir = filepath.Join(cfg.DataPath, "csv")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user