Fixed alert's unknown metrics handler
This commit is contained in:
parent
ff1cd1e01f
commit
37fdc04693
2 changed files with 12 additions and 4 deletions
|
|
@ -157,7 +157,11 @@ func (a *Alert) CanCheck() bool {
|
|||
}
|
||||
|
||||
func (a *Alert) Build() (sq.SelectBuilder, error) {
|
||||
colDef := LeftToDb[a.Query.Left]
|
||||
colDef, ok := LeftToDb[a.Query.Left]
|
||||
if !ok {
|
||||
return sq.Select(), errors.New(fmt.Sprintf("!! unsupported metric '%s' from alert: %d:%s\n", a.Query.Left, a.AlertID, a.Name))
|
||||
}
|
||||
|
||||
subQ := sq.
|
||||
Select(colDef.formula + " AS value").
|
||||
From(colDef.table).
|
||||
|
|
@ -221,4 +225,4 @@ func (a *Alert) Build() (sq.SelectBuilder, error) {
|
|||
return q, errors.New("unsupported detection method")
|
||||
}
|
||||
return q, nil
|
||||
}
|
||||
}
|
||||
|
|
@ -157,7 +157,11 @@ func (a *Alert) CanCheck() bool {
|
|||
}
|
||||
|
||||
func (a *Alert) Build() (sq.SelectBuilder, error) {
|
||||
colDef := LeftToDb[a.Query.Left]
|
||||
colDef, ok := LeftToDb[a.Query.Left]
|
||||
if !ok {
|
||||
return sq.Select(), errors.New(fmt.Sprintf("!! unsupported metric '%s' from alert: %d:%s\n", a.Query.Left, a.AlertID, a.Name))
|
||||
}
|
||||
|
||||
subQ := sq.
|
||||
Select(colDef.formula + " AS value").
|
||||
From(colDef.table).
|
||||
|
|
@ -221,4 +225,4 @@ func (a *Alert) Build() (sq.SelectBuilder, error) {
|
|||
return q, errors.New("unsupported detection method")
|
||||
}
|
||||
return q, nil
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue