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
d9f25199
Commit
d9f25199
authored
Nov 01, 2016
by
utkarshcmu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed Initialized to Pending
parent
dcaae47e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
10 deletions
+10
-10
pkg/metrics/metrics.go
+2
-2
pkg/models/alert.go
+2
-2
pkg/services/alerting/result_handler.go
+3
-3
pkg/services/sqlstore/alert.go
+1
-1
pkg/services/sqlstore/alert_test.go
+2
-2
No files found.
pkg/metrics/metrics.go
View file @
d9f25199
...
...
@@ -41,7 +41,7 @@ var (
M_Alerting_Result_State_Paused
Counter
M_Alerting_Result_State_NoData
Counter
M_Alerting_Result_State_ExecError
Counter
M_Alerting_Result_State_
Initialized
Counter
M_Alerting_Result_State_
Pending
Counter
M_Alerting_Active_Alerts
Counter
M_Alerting_Notification_Sent_Slack
Counter
M_Alerting_Notification_Sent_Email
Counter
...
...
@@ -103,7 +103,7 @@ func initMetricVars(settings *MetricSettings) {
M_Alerting_Result_State_Paused
=
RegCounter
(
"alerting.result"
,
"state"
,
"paused"
)
M_Alerting_Result_State_NoData
=
RegCounter
(
"alerting.result"
,
"state"
,
"no_data"
)
M_Alerting_Result_State_ExecError
=
RegCounter
(
"alerting.result"
,
"state"
,
"exec_error"
)
M_Alerting_Result_State_
Initialized
=
RegCounter
(
"alerting.result"
,
"state"
,
"initialized
"
)
M_Alerting_Result_State_
Pending
=
RegCounter
(
"alerting.result"
,
"state"
,
"pending
"
)
M_Alerting_Active_Alerts
=
RegCounter
(
"alerting.active_alerts"
)
M_Alerting_Notification_Sent_Slack
=
RegCounter
(
"alerting.notifications_sent"
,
"type"
,
"slack"
)
...
...
pkg/models/alert.go
View file @
d9f25199
...
...
@@ -16,7 +16,7 @@ const (
AlertStatePaused
AlertStateType
=
"paused"
AlertStateAlerting
AlertStateType
=
"alerting"
AlertStateOK
AlertStateType
=
"ok"
AlertState
Initialized
AlertStateType
=
"initialized
"
AlertState
Pending
AlertStateType
=
"pending
"
)
const
(
...
...
@@ -27,7 +27,7 @@ const (
)
func
(
s
AlertStateType
)
IsValid
()
bool
{
return
s
==
AlertStateOK
||
s
==
AlertStateNoData
||
s
==
AlertStateExecError
||
s
==
AlertStatePaused
||
s
==
AlertState
Initialized
return
s
==
AlertStateOK
||
s
==
AlertStateNoData
||
s
==
AlertStateExecError
||
s
==
AlertStatePaused
||
s
==
AlertState
Pending
}
func
(
s
NoDataOption
)
IsValid
()
bool
{
...
...
pkg/services/alerting/result_handler.go
View file @
d9f25199
...
...
@@ -86,7 +86,7 @@ func (handler *DefaultResultHandler) Handle(evalContext *EvalContext) error {
handler
.
log
.
Error
(
"Failed to save annotation for new alert state"
,
"error"
,
err
)
}
if
(
oldState
==
m
.
AlertState
Initialized
)
&&
(
evalContext
.
Rule
.
State
==
m
.
AlertStateOK
)
{
if
(
oldState
==
m
.
AlertState
Pending
)
&&
(
evalContext
.
Rule
.
State
==
m
.
AlertStateOK
)
{
handler
.
log
.
Info
(
"Notfication not sent"
,
"oldState"
,
oldState
,
"newState"
,
evalContext
.
Rule
.
State
)
}
else
{
handler
.
notifier
.
Notify
(
evalContext
)
...
...
@@ -103,8 +103,8 @@ func (handler *DefaultResultHandler) shouldUpdateAlertState(evalContext *EvalCon
func
countStateResult
(
state
m
.
AlertStateType
)
{
switch
state
{
case
m
.
AlertState
Initialized
:
metrics
.
M_Alerting_Result_State_
Initialized
.
Inc
(
1
)
case
m
.
AlertState
Pending
:
metrics
.
M_Alerting_Result_State_
Pending
.
Inc
(
1
)
case
m
.
AlertStateAlerting
:
metrics
.
M_Alerting_Result_State_Alerting
.
Inc
(
1
)
case
m
.
AlertStateOK
:
...
...
pkg/services/sqlstore/alert.go
View file @
d9f25199
...
...
@@ -173,7 +173,7 @@ func upsertAlerts(existingAlerts []*m.Alert, cmd *m.SaveAlertsCommand, sess *xor
}
else
{
alert
.
Updated
=
time
.
Now
()
alert
.
Created
=
time
.
Now
()
alert
.
State
=
m
.
AlertState
Initialized
alert
.
State
=
m
.
AlertState
Pending
alert
.
NewStateDate
=
time
.
Now
()
_
,
err
:=
sess
.
Insert
(
alert
)
...
...
pkg/services/sqlstore/alert_test.go
View file @
d9f25199
...
...
@@ -47,7 +47,7 @@ func TestAlertingDataAccess(t *testing.T) {
So
(
err2
,
ShouldBeNil
)
So
(
alert
.
Name
,
ShouldEqual
,
"Alerting title"
)
So
(
alert
.
Message
,
ShouldEqual
,
"Alerting message"
)
So
(
alert
.
State
,
ShouldEqual
,
"
initialized
"
)
So
(
alert
.
State
,
ShouldEqual
,
"
pending
"
)
So
(
alert
.
Frequency
,
ShouldEqual
,
1
)
})
...
...
@@ -77,7 +77,7 @@ func TestAlertingDataAccess(t *testing.T) {
So
(
query
.
Result
[
0
]
.
Name
,
ShouldEqual
,
"Name"
)
Convey
(
"Alert state should not be updated"
,
func
()
{
So
(
query
.
Result
[
0
]
.
State
,
ShouldEqual
,
"
initialized
"
)
So
(
query
.
Result
[
0
]
.
State
,
ShouldEqual
,
"
pending
"
)
})
})
...
...
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