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
5cf97118
Commit
5cf97118
authored
Aug 18, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(alerting): added eval match to test results
parent
2f953d75
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
9 deletions
+33
-9
pkg/api/alerting.go
+3
-0
pkg/api/dtos/alerting.go
+9
-7
pkg/services/alerting/conditions/query.go
+2
-1
public/app/features/alerting/alert_model.ts
+11
-0
public/app/features/alerting/partials/alert_tab.html
+7
-0
public/app/features/alerting/threshold_mapper.ts
+1
-1
No files found.
pkg/api/alerting.go
View file @
5cf97118
...
...
@@ -106,6 +106,9 @@ func AlertTest(c *middleware.Context, dto dtos.AlertTestCommand) Response {
for
_
,
log
:=
range
res
.
Logs
{
dtoRes
.
Logs
=
append
(
dtoRes
.
Logs
,
&
dtos
.
AlertTestResultLog
{
Message
:
log
.
Message
,
Data
:
log
.
Data
})
}
for
_
,
match
:=
range
res
.
EvalMatches
{
dtoRes
.
EvalMatches
=
append
(
dtoRes
.
EvalMatches
,
&
dtos
.
EvalMatch
{
Metric
:
match
.
Metric
,
Value
:
match
.
Value
})
}
dtoRes
.
TimeMs
=
fmt
.
Sprintf
(
"%1.3fms"
,
res
.
GetDurationMs
())
...
...
pkg/api/dtos/alerting.go
View file @
5cf97118
...
...
@@ -35,10 +35,11 @@ type AlertTestCommand struct {
}
type
AlertTestResult
struct
{
Firing
bool
`json:"firing"`
TimeMs
string
`json:"timeMs"`
Error
string
`json:"error,omitempty"`
Logs
[]
*
AlertTestResultLog
`json:"logs,omitempty"`
Firing
bool
`json:"firing"`
TimeMs
string
`json:"timeMs"`
Error
string
`json:"error,omitempty"`
EvalMatches
[]
*
EvalMatch
`json:"matches,omitempty"`
Logs
[]
*
AlertTestResultLog
`json:"logs,omitempty"`
}
type
AlertTestResultLog
struct
{
...
...
@@ -46,7 +47,8 @@ type AlertTestResultLog struct {
Data
interface
{}
`json:"data"`
}
type
AlertEvent
struct
{
Metric
string
`json:"metric"`
Value
float64
`json:"value"`
type
EvalMatch
struct
{
Tags
map
[
string
]
string
`json:"tags,omitempty"`
Metric
string
`json:"metric"`
Value
float64
`json:"value"`
}
pkg/services/alerting/conditions/query.go
View file @
5cf97118
...
...
@@ -53,8 +53,9 @@ func (c *QueryCondition) Eval(context *alerting.EvalContext) {
Metric
:
series
.
Name
,
Value
:
reducedValue
,
})
context
.
Firing
=
true
}
context
.
Firing
=
evalMatch
}
}
...
...
public/app/features/alerting/alert_model.ts
0 → 100644
View file @
5cf97118
///<reference path="../../headers/common.d.ts" />
import
_
from
'lodash'
;
import
{
QueryPart
}
from
'app/core/components/query_part/query_part'
;
import
alertDef
from
'./alert_def'
;
export
class
AlertModel
{
constructor
()
{
}
}
public/app/features/alerting/partials/alert_tab.html
View file @
5cf97118
...
...
@@ -67,6 +67,13 @@
<label
class=
"gf-form-label query-keyword"
ng-show=
"conditionModel.evaluator.params.length === 2"
>
TO
</label>
<input
class=
"gf-form-input max-width-7"
type=
"number"
ng-if=
"conditionModel.evaluator.params.length === 2"
ng-model=
"conditionModel.evaluator.params[1]"
ng-change=
"ctrl.evaluatorParamsChanged()"
></input>
</div>
<gf-form-switch
class=
"gf-form"
label=
"OR NO VALUE"
label-class=
"query-keyword"
checked=
"dashboard.editable"
>
</gf-form-switch>
<div
class=
"gf-form"
>
<label
class=
"gf-form-label"
>
<a
class=
"pointer"
tabindex=
"1"
ng-click=
"ctrl.removeCondition($index)"
>
...
...
public/app/features/alerting/threshold_mapper.ts
View file @
5cf97118
...
...
@@ -53,10 +53,10 @@ export class ThresholdMapper {
thresholds
.
push
({
value
:
value1
,
op
:
'gt'
});
thresholds
.
push
({
value
:
value2
,
op
:
'lt'
});
}
break
;
}
}
break
;
}
for
(
var
t
of
panel
.
thresholds
)
{
...
...
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