Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
cb96c6d9
Commit
cb96c6d9
authored
Sep 25, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed setting to be an alerting setting
parent
4dab595e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
46 additions
and
41 deletions
+46
-41
conf/defaults.ini
+4
-2
conf/sample.ini
+4
-2
docs/sources/installation/configuration.md
+8
-0
pkg/api/render.go
+10
-9
pkg/services/alerting/notifier.go
+7
-6
pkg/services/rendering/interface.go
+10
-10
pkg/services/rendering/rendering.go
+1
-9
pkg/setting/setting.go
+2
-3
No files found.
conf/defaults.ini
View file @
cb96c6d9
...
@@ -474,6 +474,10 @@ error_or_timeout = alerting
...
@@ -474,6 +474,10 @@ error_or_timeout = alerting
# Default setting for how Grafana handles nodata or null values in alerting. (alerting, no_data, keep_state, ok)
# Default setting for how Grafana handles nodata or null values in alerting. (alerting, no_data, keep_state, ok)
nodata_or_nullvalues
=
no_data
nodata_or_nullvalues
=
no_data
# Alert notifications can include images, but rendering many images at the same time can overload the server
# This limit will protect the server from render overloading and make sure notifications are sent out quickly
concurrent_render_limit
=
5
#################################### Explore #############################
#################################### Explore #############################
[explore]
[explore]
# Enable the Explore section
# Enable the Explore section
...
@@ -550,5 +554,3 @@ container_name =
...
@@ -550,5 +554,3 @@ container_name =
# Options to configure external image rendering server like https://github.com/grafana/grafana-image-renderer
# Options to configure external image rendering server like https://github.com/grafana/grafana-image-renderer
server_url
=
server_url
=
callback_url
=
callback_url
=
concurrent_limit
=
10
concurrent_limit_alerting
=
5
conf/sample.ini
View file @
cb96c6d9
...
@@ -393,6 +393,10 @@ log_queries =
...
@@ -393,6 +393,10 @@ log_queries =
# Default setting for how Grafana handles nodata or null values in alerting. (alerting, no_data, keep_state, ok)
# Default setting for how Grafana handles nodata or null values in alerting. (alerting, no_data, keep_state, ok)
;nodata_or_nullvalues = no_data
;nodata_or_nullvalues = no_data
# Alert notifications can include images, but rendering many images at the same time can overload the server
# This limit will protect the server from render overloading and make sure notifications are sent out quickly
;concurrent_render_limit = 5
#################################### Explore #############################
#################################### Explore #############################
[explore]
[explore]
# Enable the Explore section
# Enable the Explore section
...
@@ -471,5 +475,3 @@ log_queries =
...
@@ -471,5 +475,3 @@ log_queries =
# Options to configure external image rendering server like https://github.com/grafana/grafana-image-renderer
# Options to configure external image rendering server like https://github.com/grafana/grafana-image-renderer
;server_url =
;server_url =
;callback_url =
;callback_url =
;concurrent_limit = 10
;concurrent_limit_alerting = 5
docs/sources/installation/configuration.md
View file @
cb96c6d9
...
@@ -566,3 +566,11 @@ Default setting for new alert rules. Defaults to categorize error and timeouts a
...
@@ -566,3 +566,11 @@ Default setting for new alert rules. Defaults to categorize error and timeouts a
> Available in 5.3 and above
> Available in 5.3 and above
Default setting for how Grafana handles nodata or null values in alerting. (alerting, no_data, keep_state, ok)
Default setting for how Grafana handles nodata or null values in alerting. (alerting, no_data, keep_state, ok)
# concurrent_render_limit
> Available in 5.3 and above
Alert notifications can include images, but rendering many images at the same time can overload the server.
This limit will protect the server from render overloading and make sure notifications are sent out quickly. Default
value is
`5`
.
pkg/api/render.go
View file @
cb96c6d9
...
@@ -41,15 +41,16 @@ func (hs *HTTPServer) RenderToPng(c *m.ReqContext) {
...
@@ -41,15 +41,16 @@ func (hs *HTTPServer) RenderToPng(c *m.ReqContext) {
}
}
result
,
err
:=
hs
.
RenderService
.
Render
(
c
.
Req
.
Context
(),
rendering
.
Opts
{
result
,
err
:=
hs
.
RenderService
.
Render
(
c
.
Req
.
Context
(),
rendering
.
Opts
{
Width
:
width
,
Width
:
width
,
Height
:
height
,
Height
:
height
,
Timeout
:
time
.
Duration
(
timeout
)
*
time
.
Second
,
Timeout
:
time
.
Duration
(
timeout
)
*
time
.
Second
,
OrgId
:
c
.
OrgId
,
OrgId
:
c
.
OrgId
,
UserId
:
c
.
UserId
,
UserId
:
c
.
UserId
,
OrgRole
:
c
.
OrgRole
,
OrgRole
:
c
.
OrgRole
,
Path
:
c
.
Params
(
"*"
)
+
queryParams
,
Path
:
c
.
Params
(
"*"
)
+
queryParams
,
Timezone
:
queryReader
.
Get
(
"tz"
,
""
),
Timezone
:
queryReader
.
Get
(
"tz"
,
""
),
Encoding
:
queryReader
.
Get
(
"encoding"
,
""
),
Encoding
:
queryReader
.
Get
(
"encoding"
,
""
),
ConcurrentLimit
:
30
,
})
})
if
err
!=
nil
&&
err
==
rendering
.
ErrTimeout
{
if
err
!=
nil
&&
err
==
rendering
.
ErrTimeout
{
...
...
pkg/services/alerting/notifier.go
View file @
cb96c6d9
...
@@ -11,6 +11,7 @@ import (
...
@@ -11,6 +11,7 @@ import (
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/services/rendering"
"github.com/grafana/grafana/pkg/services/rendering"
"github.com/grafana/grafana/pkg/setting"
m
"github.com/grafana/grafana/pkg/models"
m
"github.com/grafana/grafana/pkg/models"
)
)
...
@@ -108,12 +109,12 @@ func (n *notificationService) uploadImage(context *EvalContext) (err error) {
...
@@ -108,12 +109,12 @@ func (n *notificationService) uploadImage(context *EvalContext) (err error) {
}
}
renderOpts
:=
rendering
.
Opts
{
renderOpts
:=
rendering
.
Opts
{
Width
:
1000
,
Width
:
1000
,
Height
:
500
,
Height
:
500
,
Timeout
:
alertTimeout
/
2
,
Timeout
:
alertTimeout
/
2
,
OrgId
:
context
.
Rule
.
OrgId
,
OrgId
:
context
.
Rule
.
OrgId
,
OrgRole
:
m
.
ROLE_ADMIN
,
OrgRole
:
m
.
ROLE_ADMIN
,
IsAlert
:
true
,
ConcurrentLimit
:
setting
.
AlertingRenderLimit
,
}
}
ref
,
err
:=
context
.
GetDashboardUID
()
ref
,
err
:=
context
.
GetDashboardUID
()
...
...
pkg/services/rendering/interface.go
View file @
cb96c6d9
...
@@ -13,16 +13,16 @@ var ErrNoRenderer = errors.New("No renderer plugin found nor is an external rend
...
@@ -13,16 +13,16 @@ var ErrNoRenderer = errors.New("No renderer plugin found nor is an external rend
var
ErrPhantomJSNotInstalled
=
errors
.
New
(
"PhantomJS executable not found"
)
var
ErrPhantomJSNotInstalled
=
errors
.
New
(
"PhantomJS executable not found"
)
type
Opts
struct
{
type
Opts
struct
{
Width
int
Width
int
Height
int
Height
int
Timeout
time
.
Duration
Timeout
time
.
Duration
OrgId
int64
OrgId
int64
UserId
int64
UserId
int64
OrgRole
models
.
RoleType
OrgRole
models
.
RoleType
Path
string
Path
string
Encoding
string
Encoding
string
Timezone
string
Timezone
string
IsAlert
bool
ConcurrentLimit
int
}
}
type
RenderResult
struct
{
type
RenderResult
struct
{
...
...
pkg/services/rendering/rendering.go
View file @
cb96c6d9
...
@@ -90,16 +90,8 @@ func (rs *RenderingService) Run(ctx context.Context) error {
...
@@ -90,16 +90,8 @@ func (rs *RenderingService) Run(ctx context.Context) error {
return
err
return
err
}
}
func
(
rs
*
RenderingService
)
getLimit
(
isAlerting
bool
)
int
{
if
isAlerting
{
return
rs
.
Cfg
.
RendererLimitAlerting
}
else
{
return
rs
.
Cfg
.
RendererLimit
}
}
func
(
rs
*
RenderingService
)
Render
(
ctx
context
.
Context
,
opts
Opts
)
(
*
RenderResult
,
error
)
{
func
(
rs
*
RenderingService
)
Render
(
ctx
context
.
Context
,
opts
Opts
)
(
*
RenderResult
,
error
)
{
if
rs
.
inProgressCount
>
rs
.
getLimit
(
opts
.
IsAlert
)
{
if
rs
.
inProgressCount
>
opts
.
ConcurrentLimit
{
return
&
RenderResult
{
return
&
RenderResult
{
FilePath
:
filepath
.
Join
(
setting
.
HomePath
,
"public/img/rendering_limit.png"
),
FilePath
:
filepath
.
Join
(
setting
.
HomePath
,
"public/img/rendering_limit.png"
),
},
nil
},
nil
...
...
pkg/setting/setting.go
View file @
cb96c6d9
...
@@ -166,6 +166,7 @@ var (
...
@@ -166,6 +166,7 @@ var (
// Alerting
// Alerting
AlertingEnabled
bool
AlertingEnabled
bool
ExecuteAlerts
bool
ExecuteAlerts
bool
AlertingRenderLimit
int
AlertingErrorOrTimeout
string
AlertingErrorOrTimeout
string
AlertingNoDataOrNullValues
string
AlertingNoDataOrNullValues
string
...
@@ -648,9 +649,6 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
...
@@ -648,9 +649,6 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
// Rendering
// Rendering
renderSec
:=
iniFile
.
Section
(
"rendering"
)
renderSec
:=
iniFile
.
Section
(
"rendering"
)
cfg
.
RendererLimit
=
renderSec
.
Key
(
"concurrent_limit"
)
.
MustInt
(
10
)
cfg
.
RendererLimitAlerting
=
renderSec
.
Key
(
"concurrent_limit"
)
.
MustInt
(
5
)
cfg
.
RendererUrl
=
renderSec
.
Key
(
"server_url"
)
.
String
()
cfg
.
RendererUrl
=
renderSec
.
Key
(
"server_url"
)
.
String
()
cfg
.
RendererCallbackUrl
=
renderSec
.
Key
(
"callback_url"
)
.
String
()
cfg
.
RendererCallbackUrl
=
renderSec
.
Key
(
"callback_url"
)
.
String
()
if
cfg
.
RendererCallbackUrl
==
""
{
if
cfg
.
RendererCallbackUrl
==
""
{
...
@@ -683,6 +681,7 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
...
@@ -683,6 +681,7 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
alerting
:=
iniFile
.
Section
(
"alerting"
)
alerting
:=
iniFile
.
Section
(
"alerting"
)
AlertingEnabled
=
alerting
.
Key
(
"enabled"
)
.
MustBool
(
true
)
AlertingEnabled
=
alerting
.
Key
(
"enabled"
)
.
MustBool
(
true
)
ExecuteAlerts
=
alerting
.
Key
(
"execute_alerts"
)
.
MustBool
(
true
)
ExecuteAlerts
=
alerting
.
Key
(
"execute_alerts"
)
.
MustBool
(
true
)
AlertingRenderLimit
=
alerting
.
Key
(
"concurrent_render_limit"
)
.
MustInt
(
5
)
AlertingErrorOrTimeout
=
alerting
.
Key
(
"error_or_timeout"
)
.
MustString
(
"alerting"
)
AlertingErrorOrTimeout
=
alerting
.
Key
(
"error_or_timeout"
)
.
MustString
(
"alerting"
)
AlertingNoDataOrNullValues
=
alerting
.
Key
(
"nodata_or_nullvalues"
)
.
MustString
(
"no_data"
)
AlertingNoDataOrNullValues
=
alerting
.
Key
(
"nodata_or_nullvalues"
)
.
MustString
(
"no_data"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment