mirror of
https://github.com/ccfos/nightingale.git
synced 2026-03-02 22:19:10 +00:00
Compare commits
1 Commits
es-sql-ale
...
change-eve
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8ba7c13ea |
@@ -355,6 +355,9 @@ func (arw *AlertRuleWorker) GetPromAnomalyPoint(ruleConfig string) ([]models.Ano
|
||||
).Set(float64(len(lst)))
|
||||
}
|
||||
|
||||
for i := range lst {
|
||||
lst[i].QueryCount = len(rule.Queries)
|
||||
}
|
||||
return lst, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -686,7 +686,12 @@ func labelMapToArr(m map[string]string) []string {
|
||||
}
|
||||
|
||||
func Hash(ruleId, datasourceId int64, vector models.AnomalyPoint) string {
|
||||
return str.MD5(fmt.Sprintf("%d_%s_%d_%d_%s", ruleId, vector.Labels.String(), datasourceId, vector.Severity, vector.Query))
|
||||
query := ""
|
||||
if vector.QueryCount > 1 {
|
||||
query = vector.Query
|
||||
}
|
||||
|
||||
return str.MD5(fmt.Sprintf("%d_%s_%d_%d_%s", ruleId, vector.Labels.String(), datasourceId, vector.Severity, query))
|
||||
}
|
||||
|
||||
func TagHash(vector models.AnomalyPoint) string {
|
||||
|
||||
@@ -21,6 +21,7 @@ type AnomalyPoint struct {
|
||||
ValuesUnit map[string]unit.FormattedValue `json:"values_unit"`
|
||||
RecoverConfig RecoverConfig `json:"recover_config"`
|
||||
TriggerType TriggerType `json:"trigger_type"`
|
||||
QueryCount int `json:"query_count"`
|
||||
}
|
||||
|
||||
type TriggerType string
|
||||
|
||||
Reference in New Issue
Block a user