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
4526660c
Commit
4526660c
authored
Nov 02, 2018
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wire up debounce setting in the ui
parent
2d3a5754
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
4 deletions
+29
-4
pkg/services/alerting/extractor.go
+11
-0
pkg/services/sqlstore/alert.go
+2
-1
public/app/features/alerting/AlertTabCtrl.ts
+1
-0
public/app/features/alerting/partials/alert_tab.html
+15
-3
No files found.
pkg/services/alerting/extractor.go
View file @
4526660c
...
...
@@ -2,6 +2,7 @@ package alerting
import
(
"errors"
"time"
"fmt"
...
...
@@ -113,6 +114,15 @@ func (e *DashAlertExtractor) getAlertFromPanels(jsonWithPanels *simplejson.Json,
return
nil
,
ValidationError
{
Reason
:
"Could not parse frequency"
}
}
rawDebouce
:=
jsonAlert
.
Get
(
"debounceDuration"
)
.
MustString
()
var
debounceDuration
time
.
Duration
if
rawDebouce
!=
""
{
debounceDuration
,
err
=
time
.
ParseDuration
(
rawDebouce
)
if
err
!=
nil
{
return
nil
,
ValidationError
{
Reason
:
"Could not parse debounceDuration"
}
}
}
alert
:=
&
m
.
Alert
{
DashboardId
:
e
.
Dash
.
Id
,
OrgId
:
e
.
OrgID
,
...
...
@@ -122,6 +132,7 @@ func (e *DashAlertExtractor) getAlertFromPanels(jsonWithPanels *simplejson.Json,
Handler
:
jsonAlert
.
Get
(
"handler"
)
.
MustInt64
(),
Message
:
jsonAlert
.
Get
(
"message"
)
.
MustString
(),
Frequency
:
frequency
,
DebounceDuration
:
debounceDuration
,
}
for
_
,
condition
:=
range
jsonAlert
.
Get
(
"conditions"
)
.
MustArray
()
{
...
...
pkg/services/sqlstore/alert.go
View file @
4526660c
...
...
@@ -193,7 +193,8 @@ func updateAlerts(existingAlerts []*m.Alert, cmd *m.SaveAlertsCommand, sess *DBS
if
alertToUpdate
.
ContainsUpdates
(
alert
)
{
alert
.
Updated
=
timeNow
()
alert
.
State
=
alertToUpdate
.
State
sess
.
MustCols
(
"message"
)
sess
.
MustCols
(
"message"
,
"debounce_duration"
)
_
,
err
:=
sess
.
ID
(
alert
.
Id
)
.
Update
(
alert
)
if
err
!=
nil
{
return
err
...
...
public/app/features/alerting/AlertTabCtrl.ts
View file @
4526660c
...
...
@@ -169,6 +169,7 @@ export class AlertTabCtrl {
alert
.
frequency
=
alert
.
frequency
||
'1m'
;
alert
.
handler
=
alert
.
handler
||
1
;
alert
.
notifications
=
alert
.
notifications
||
[];
alert
.
debounceDuration
=
alert
.
debounceDuration
||
'5m'
;
const
defaultName
=
this
.
panel
.
title
+
' alert'
;
alert
.
name
=
alert
.
name
||
defaultName
;
...
...
public/app/features/alerting/partials/alert_tab.html
View file @
4526660c
...
...
@@ -28,9 +28,21 @@
<h5
class=
"section-heading"
>
Alert Config
</h5>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-6"
>
Name
</span>
<input
type=
"text"
class=
"gf-form-input width-20"
ng-model=
"ctrl.alert.name"
>
<span
class=
"gf-form-label"
>
Evaluate every
</span>
<input
class=
"gf-form-input max-width-5"
type=
"text"
ng-model=
"ctrl.alert.frequency"
></input>
<input
type=
"text"
class=
"gf-form-input width-22"
ng-model=
"ctrl.alert.name"
>
</div>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-8"
>
Evaluate every
</span>
<input
class=
"gf-form-input max-width-5"
type=
"text"
ng-model=
"ctrl.alert.frequency"
>
</div>
<div
class=
"gf-form max-width-15"
>
<label
class=
"gf-form-label width-10"
>
Debounce duration
</label>
<input
type=
"text"
class=
"gf-form-input max-width-5"
ng-model=
"ctrl.alert.debounceDuration"
spellcheck=
'false'
placeholder=
"5m"
>
<info-popover
mode=
"right-absolute"
>
Configuring this value means that an alert rule have to be firing for atleast this duration before changing state.
This should reduce false positive alerts and avoid flapping alerts.
</info-popover>
</div>
</div>
</div>
...
...
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