Skip to content

Commit

Permalink
Merge branch 'master' into aa_643_changedetect
Browse files Browse the repository at this point in the history
  • Loading branch information
aanthony1243 authored Mar 9, 2018
2 parents 4f6e0c6 + e48a302 commit 193c1b8
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 84 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

### Features


- [#1844](https://github.com/influxdata/kapacitor/pull/1844): Added a new kapacitor node changeDetect that emits a value
for each time a series field changes.

- [#1828](https://github.com/influxdata/kapacitor/pull/1828): Add recoverable field to JSON alert response to indicate whether the
alert will auto-recover.
- [#1823](https://github.com/influxdata/kapacitor/pull/1823): Update OpsGenie integration to use the v2 API.
To upgrade to using the new API simply update your config and TICKscripts to use opsgenie2 instead of opsgenie.
If your `opsgenie` config uses the `recovery_url` option, for `opsgenie2` you will need to change it to the `recovery_action` option.
Expand Down
13 changes: 7 additions & 6 deletions alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,12 +725,13 @@ func (n *AlertNode) event(
Level: level,
},
Data: alert.EventData{
Name: name,
TaskName: n.et.Task.ID,
Group: string(group),
Tags: tags,
Fields: fields,
Result: result,
Name: name,
TaskName: n.et.Task.ID,
Group: string(group),
Tags: tags,
Fields: fields,
Result: result,
Recoverable: !n.a.NoRecoveriesFlag,
},
}
return event, nil
Expand Down
4 changes: 4 additions & 0 deletions alert/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func (e Event) AlertData() Data {
Level: e.State.Level,
Data: e.Data.Result,
PreviousLevel: e.previousState.Level,
Recoverable: e.Data.Recoverable,
}
}

Expand Down Expand Up @@ -80,6 +81,8 @@ type EventData struct {
// Fields of alerting data point.
Fields map[string]interface{}

Recoverable bool

Result models.Result
}

Expand Down Expand Up @@ -179,4 +182,5 @@ type Data struct {
Level Level `json:"level"`
Data models.Result `json:"data"`
PreviousLevel Level `json:"previousLevel"`
Recoverable bool `json:"recoverable"`
}
5 changes: 5 additions & 0 deletions integrations/batcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,7 @@ func TestBatch_AlertStateChangesOnly(t *testing.T) {
Time: time.Date(1971, 1, 1, 0, 0, 0, 0, time.UTC),
Level: alert.Critical,
PreviousLevel: alert.OK,
Recoverable: true,
}
ad.Data = models.Result{}
if eq, msg := compareAlertData(expAd, ad); !eq {
Expand All @@ -1520,6 +1521,7 @@ func TestBatch_AlertStateChangesOnly(t *testing.T) {
Duration: 38 * time.Second,
Level: alert.OK,
PreviousLevel: alert.Critical,
Recoverable: true,
}
ad.Data = models.Result{}
if eq, msg := compareAlertData(expAd, ad); !eq {
Expand Down Expand Up @@ -1580,6 +1582,7 @@ func TestBatch_AlertStateChangesOnlyExpired(t *testing.T) {
Duration: time.Duration(rc-1) * 20 * time.Second,
Level: alert.Critical,
PreviousLevel: alert.OK,
Recoverable: true,
}
case 2:
expAd = alert.Data{
Expand All @@ -1589,6 +1592,7 @@ func TestBatch_AlertStateChangesOnlyExpired(t *testing.T) {
Duration: time.Duration(rc-1) * 20 * time.Second,
Level: alert.Critical,
PreviousLevel: alert.Critical,
Recoverable: true,
}
case 3:
expAd = alert.Data{
Expand All @@ -1598,6 +1602,7 @@ func TestBatch_AlertStateChangesOnlyExpired(t *testing.T) {
Duration: 38 * time.Second,
Level: alert.OK,
PreviousLevel: alert.Critical,
Recoverable: true,
}
}
if eq, msg := compareAlertData(expAd, ad); !eq {
Expand Down
Loading

0 comments on commit 193c1b8

Please sign in to comment.