-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: missing related logs or traces links in alert notification (#5946)
- Loading branch information
1 parent
f854cdd
commit 39f9fc6
Showing
4 changed files
with
276 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package rules | ||
|
||
import "time" | ||
|
||
var ( | ||
testCases = []struct { | ||
targetUnit string | ||
yAxisUnit string | ||
values [][]interface{} | ||
expectAlerts int | ||
compareOp string | ||
matchType string | ||
target float64 | ||
summaryAny []string | ||
}{ | ||
{ | ||
targetUnit: "s", | ||
yAxisUnit: "ns", | ||
values: [][]interface{}{ | ||
{float64(572588400), "attr", time.Now()}, // 0.57 seconds | ||
{float64(572386400), "attr", time.Now().Add(1 * time.Second)}, // 0.57 seconds | ||
{float64(300947400), "attr", time.Now().Add(2 * time.Second)}, // 0.3 seconds | ||
{float64(299316000), "attr", time.Now().Add(3 * time.Second)}, // 0.3 seconds | ||
{float64(66640400.00000001), "attr", time.Now().Add(4 * time.Second)}, // 0.06 seconds | ||
}, | ||
expectAlerts: 0, | ||
compareOp: "1", // Above | ||
matchType: "1", // Once | ||
target: 1, // 1 second | ||
}, | ||
{ | ||
targetUnit: "ms", | ||
yAxisUnit: "ns", | ||
values: [][]interface{}{ | ||
{float64(572588400), "attr", time.Now()}, // 572.58 ms | ||
{float64(572386400), "attr", time.Now().Add(1 * time.Second)}, // 572.38 ms | ||
{float64(300947400), "attr", time.Now().Add(2 * time.Second)}, // 300.94 ms | ||
{float64(299316000), "attr", time.Now().Add(3 * time.Second)}, // 299.31 ms | ||
{float64(66640400.00000001), "attr", time.Now().Add(4 * time.Second)}, // 66.64 ms | ||
}, | ||
expectAlerts: 4, | ||
compareOp: "1", // Above | ||
matchType: "1", // Once | ||
target: 200, // 200 ms | ||
summaryAny: []string{ | ||
"observed metric value is 299 ms", | ||
"the observed metric value is 573 ms", | ||
"the observed metric value is 572 ms", | ||
"the observed metric value is 301 ms", | ||
}, | ||
}, | ||
{ | ||
targetUnit: "decgbytes", | ||
yAxisUnit: "bytes", | ||
values: [][]interface{}{ | ||
{float64(2863284053), "attr", time.Now()}, // 2.86 GB | ||
{float64(2863388842), "attr", time.Now().Add(1 * time.Second)}, // 2.86 GB | ||
{float64(300947400), "attr", time.Now().Add(2 * time.Second)}, // 0.3 GB | ||
{float64(299316000), "attr", time.Now().Add(3 * time.Second)}, // 0.3 GB | ||
{float64(66640400.00000001), "attr", time.Now().Add(4 * time.Second)}, // 66.64 MB | ||
}, | ||
expectAlerts: 0, | ||
compareOp: "1", // Above | ||
matchType: "1", // Once | ||
target: 200, // 200 GB | ||
}, | ||
} | ||
) |