mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-04 11:25:52 +08:00
91 lines
3.1 KiB
Go
91 lines
3.1 KiB
Go
package rules
|
|
|
|
import "time"
|
|
|
|
var (
|
|
testCases = []struct {
|
|
targetUnit string
|
|
yAxisUnit string
|
|
values [][]interface{}
|
|
metaValues [][]interface{}
|
|
attrMetaValues [][]interface{}
|
|
resourceMetaValues [][]interface{}
|
|
createTableValues [][]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
|
|
},
|
|
metaValues: [][]interface{}{},
|
|
createTableValues: [][]interface{}{
|
|
{"statement"},
|
|
},
|
|
attrMetaValues: [][]interface{}{},
|
|
resourceMetaValues: [][]interface{}{},
|
|
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
|
|
},
|
|
metaValues: [][]interface{}{},
|
|
createTableValues: [][]interface{}{
|
|
{"statement"},
|
|
},
|
|
attrMetaValues: [][]interface{}{},
|
|
resourceMetaValues: [][]interface{}{},
|
|
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
|
|
},
|
|
metaValues: [][]interface{}{},
|
|
createTableValues: [][]interface{}{
|
|
{"statement"},
|
|
},
|
|
attrMetaValues: [][]interface{}{},
|
|
resourceMetaValues: [][]interface{}{},
|
|
expectAlerts: 0,
|
|
compareOp: "1", // Above
|
|
matchType: "1", // Once
|
|
target: 200, // 200 GB
|
|
},
|
|
}
|
|
)
|