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
a7be3b91
Commit
a7be3b91
authored
Nov 08, 2016
by
Carl Bergquist
Committed by
GitHub
Nov 08, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6499 from utkarshcmu/last
Added last function for alerting conditions
parents
5bbdd99d
841fb74b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
0 deletions
+16
-0
pkg/services/alerting/conditions/reducer.go
+9
-0
pkg/services/alerting/conditions/reducer_test.go
+6
-0
public/app/features/alerting/alert_def.ts
+1
-0
No files found.
pkg/services/alerting/conditions/reducer.go
View file @
a7be3b91
...
...
@@ -62,6 +62,15 @@ func (s *SimpleReducer) Reduce(series *tsdb.TimeSeries) null.Float {
case
"count"
:
value
=
float64
(
len
(
series
.
Points
))
allNull
=
false
case
"last"
:
points
:=
series
.
Points
for
i
:=
len
(
points
)
-
1
;
i
>=
0
;
i
--
{
if
points
[
i
][
0
]
.
Valid
{
value
=
points
[
i
][
0
]
.
Float64
allNull
=
false
break
}
}
}
if
allNull
{
...
...
pkg/services/alerting/conditions/reducer_test.go
View file @
a7be3b91
...
...
@@ -35,6 +35,12 @@ func TestSimpleReducer(t *testing.T) {
result
:=
testReducer
(
"count"
,
1
,
2
,
3000
)
So
(
result
,
ShouldEqual
,
float64
(
3
))
})
Convey
(
"last"
,
func
()
{
result
:=
testReducer
(
"last"
,
1
,
2
,
3000
)
So
(
result
,
ShouldEqual
,
float64
(
3000
))
})
})
}
...
...
public/app/features/alerting/alert_def.ts
View file @
a7be3b91
...
...
@@ -34,6 +34,7 @@ var reducerTypes = [
{
text
:
'max()'
,
value
:
'max'
},
{
text
:
'sum()'
,
value
:
'sum'
},
{
text
:
'count()'
,
value
:
'count'
},
{
text
:
'last()'
,
value
:
'last'
},
];
var
noDataModes
=
[
...
...
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