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
14eba30f
Commit
14eba30f
authored
Jul 23, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(alerting): more work on notifications
parent
a6c60947
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
78 deletions
+0
-78
pkg/services/alerting/notifier.go
+0
-0
pkg/services/alerting/transformers/aggregation.go
+0
-71
pkg/services/alerting/transformers/transformer.go
+0
-7
No files found.
pkg/services/alerting/notifier.go
View file @
14eba30f
This diff is collapsed.
Click to expand it.
pkg/services/alerting/transformers/aggregation.go
deleted
100644 → 0
View file @
a6c60947
package
transformers
import
(
"fmt"
"math"
"github.com/grafana/grafana/pkg/tsdb"
)
func
NewAggregationTransformer
(
method
string
)
*
AggregationTransformer
{
return
&
AggregationTransformer
{
Method
:
method
,
}
}
type
AggregationTransformer
struct
{
Method
string
}
func
(
at
*
AggregationTransformer
)
Transform
(
timeserie
*
tsdb
.
TimeSeries
)
(
float64
,
error
)
{
if
at
.
Method
==
"avg"
{
sum
:=
float64
(
0
)
for
_
,
point
:=
range
timeserie
.
Points
{
sum
+=
point
[
0
]
}
return
sum
/
float64
(
len
(
timeserie
.
Points
)),
nil
}
if
at
.
Method
==
"sum"
{
sum
:=
float64
(
0
)
for
_
,
v
:=
range
timeserie
.
Points
{
sum
+=
v
[
0
]
}
return
sum
,
nil
}
if
at
.
Method
==
"min"
{
min
:=
timeserie
.
Points
[
0
][
0
]
for
_
,
v
:=
range
timeserie
.
Points
{
if
v
[
0
]
<
min
{
min
=
v
[
0
]
}
}
return
min
,
nil
}
if
at
.
Method
==
"max"
{
max
:=
timeserie
.
Points
[
0
][
0
]
for
_
,
v
:=
range
timeserie
.
Points
{
if
v
[
0
]
>
max
{
max
=
v
[
0
]
}
}
return
max
,
nil
}
if
at
.
Method
==
"mean"
{
midPosition
:=
int64
(
math
.
Floor
(
float64
(
len
(
timeserie
.
Points
))
/
float64
(
2
)))
return
timeserie
.
Points
[
midPosition
][
0
],
nil
}
return
float64
(
0
),
fmt
.
Errorf
(
"Missing method"
)
}
pkg/services/alerting/transformers/transformer.go
deleted
100644 → 0
View file @
a6c60947
package
transformers
import
"github.com/grafana/grafana/pkg/tsdb"
type
Transformer
interface
{
Transform
(
timeserie
*
tsdb
.
TimeSeries
)
(
float64
,
error
)
}
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