forked from influxdata/kapacitor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multiple field support to Change Detect
- Loading branch information
1 parent
ca77ad0
commit ec22ea9
Showing
18 changed files
with
238 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,6 +197,51 @@ func TestStream_ChangeDetect(t *testing.T) { | |
|
||
testStreamerWithOutput(t, "TestStream_ChangeDetect", script, 15*time.Second, er, false, nil) | ||
} | ||
func TestStream_ChangeDetect_Many(t *testing.T) { | ||
|
||
var script = `stream | ||
|from().measurement('packets') | ||
|changeDetect('a','b') | ||
|window() | ||
.period(6s) | ||
.every(6s) | ||
|httpOut('TestStream_ChangeDetect_Many') | ||
` | ||
|
||
er := models.Result{ | ||
Series: models.Rows{ | ||
{ | ||
Name: "packets", | ||
Tags: nil, | ||
Columns: []string{"time", "a", "b"}, | ||
Values: [][]interface{}{ | ||
[]interface{}{ | ||
time.Date(1971, 1, 1, 0, 0, 0, 0, time.UTC), | ||
"bad", | ||
0.0, | ||
}, | ||
[]interface{}{ | ||
time.Date(1971, 1, 1, 0, 0, 1, 0, time.UTC), | ||
"good", | ||
0.0, | ||
}, | ||
[]interface{}{ | ||
time.Date(1971, 1, 1, 0, 0, 4, 0, time.UTC), | ||
"bad", | ||
1.0, | ||
}, | ||
[]interface{}{ | ||
time.Date(1971, 1, 1, 0, 0, 5, 0, time.UTC), | ||
"bad", | ||
0.0, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
testStreamerWithOutput(t, "TestStream_ChangeDetect_Many", script, 15*time.Second, er, false, nil) | ||
} | ||
|
||
func TestStream_Derivative(t *testing.T) { | ||
|
||
|
@@ -10071,9 +10116,9 @@ Value: {{ index .Fields "count" }} | |
"Mime-Version": []string{"1.0"}, | ||
"Content-Type": []string{"text/html; charset=UTF-8"}, | ||
"Content-Transfer-Encoding": []string{"quoted-printable"}, | ||
"To": []string{"[email protected], [email protected]"}, | ||
"From": []string{"[email protected]"}, | ||
"Subject": []string{"kapacitor.cpu.serverA is CRITICAL"}, | ||
"To": []string{"[email protected], [email protected]"}, | ||
"From": []string{"[email protected]"}, | ||
"Subject": []string{"kapacitor.cpu.serverA is CRITICAL"}, | ||
}, | ||
Body: ` | ||
<b>kapacitor.cpu.serverA is CRITICAL</b> | ||
|
@@ -10087,9 +10132,9 @@ Value: 10 | |
"Mime-Version": []string{"1.0"}, | ||
"Content-Type": []string{"text/html; charset=UTF-8"}, | ||
"Content-Transfer-Encoding": []string{"quoted-printable"}, | ||
"To": []string{"[email protected], [email protected]"}, | ||
"From": []string{"[email protected]"}, | ||
"Subject": []string{"kapacitor.cpu.serverA is CRITICAL"}, | ||
"To": []string{"[email protected], [email protected]"}, | ||
"From": []string{"[email protected]"}, | ||
"Subject": []string{"kapacitor.cpu.serverA is CRITICAL"}, | ||
}, | ||
Body: ` | ||
<b>kapacitor.cpu.serverA is CRITICAL</b> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
{"name":"packets","points":[{"fields":{"value":"bad"},"time":"2015-10-18T00:00:00Z"},{"fields":{"value":"good"},"time":"2015-10-18T00:00:02Z"},{"fields":{"value":"good"},"time":"2015-10-18T00:00:04Z"},{"fields":{"value2":"good"},"time":"2015-10-18T00:00:05Z"},{"fields":{"value":"bad"},"time":"2015-10-18T00:00:06Z"},{"fields":{"value":"good"},"time":"2015-10-18T00:00:08Z"}]} | ||
{ | ||
"name":"packets", | ||
"points":[ | ||
{"fields":{"value":"bad"},"time":"2015-10-18T00:00:00Z"}, | ||
{"fields":{"value":"good"},"time":"2015-10-18T00:00:02Z"}, | ||
{"fields":{"value":"good"},"time":"2015-10-18T00:00:04Z"}, | ||
{"fields":{"value2":"good"},"time":"2015-10-18T00:00:05Z"}, | ||
{"fields":{"value":"bad"},"time":"2015-10-18T00:00:06Z"}, | ||
{"fields":{"value":"good"},"time":"2015-10-18T00:00:08Z"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name":"packets", | ||
"points":[ | ||
{"fields":{"a":"bad","b":0},"time":"2015-10-18T00:00:00Z"}, | ||
{"fields":{"a":"good","b":0},"time":"2015-10-18T00:00:02Z"}, | ||
{"fields":{"a":"good","b":0},"time":"2015-10-18T00:00:04Z"}, | ||
{"fields":{"a":"good","b":0,"c":"something else"},"time":"2015-10-18T00:00:05Z"}, | ||
{"fields":{"a":"bad","b":1},"time":"2015-10-18T00:00:06Z"}, | ||
{"fields":{"a":"bad","b":0},"time":"2015-10-18T00:00:08Z"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
dbname | ||
rpname | ||
packets a="bad",b=0 0000000000 | ||
dbname | ||
rpname | ||
packets a="good",b=0 0000000001 | ||
dbname | ||
rpname | ||
packets a="good",b=0 0000000002 | ||
dbname | ||
rpname | ||
packets a="good",b=0,c="something else" 0000000003 | ||
dbname | ||
rpname | ||
packets a="bad",b=1 0000000004 | ||
dbname | ||
rpname | ||
packets a="bad",b=0 0000000005 | ||
dbname | ||
rpname | ||
packets a="pump",b=2 0000000006 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.