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
9511f89a
Commit
9511f89a
authored
Sep 08, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(alerting): fixes bug in query conditions
parent
bec099cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
pkg/services/alerting/conditions/query.go
+2
-2
pkg/services/alerting/conditions/query_test.go
+13
-0
No files found.
pkg/services/alerting/conditions/query.go
View file @
9511f89a
...
...
@@ -55,13 +55,13 @@ func (c *QueryCondition) Eval(context *alerting.EvalContext) {
})
}
context
.
Firing
=
evalMatch
// handle no data scenario
if
reducedValue
==
nil
{
context
.
NoDataFound
=
true
}
}
context
.
Firing
=
len
(
context
.
EvalMatches
)
>
0
}
func
(
c
*
QueryCondition
)
executeQuery
(
context
*
alerting
.
EvalContext
)
(
tsdb
.
TimeSeriesSlice
,
error
)
{
...
...
pkg/services/alerting/conditions/query_test.go
View file @
9511f89a
...
...
@@ -59,6 +59,19 @@ func TestQueryCondition(t *testing.T) {
So
(
ctx
.
result
.
Error
,
ShouldBeNil
)
So
(
ctx
.
result
.
Firing
,
ShouldBeFalse
)
})
Convey
(
"Should fire if only first serie matches"
,
func
()
{
one
:=
float64
(
120
)
two
:=
float64
(
0
)
ctx
.
series
=
tsdb
.
TimeSeriesSlice
{
tsdb
.
NewTimeSeries
(
"test1"
,
[][
2
]
*
float64
{{
&
one
,
&
two
}}),
tsdb
.
NewTimeSeries
(
"test2"
,
[][
2
]
*
float64
{{
&
two
,
&
two
}}),
}
ctx
.
exec
()
So
(
ctx
.
result
.
Error
,
ShouldBeNil
)
So
(
ctx
.
result
.
Firing
,
ShouldBeTrue
)
})
})
})
}
...
...
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