@@ -478,14 +478,15 @@ func getAlertBody(stream string) string {
478
478
{
479
479
"severity": "medium",
480
480
"title": "AlertTitle",
481
- "query ": "SELECT * FROM %s",
481
+ "stream ": "%s",
482
482
"alertType": "threshold",
483
- "aggregateConfig": {
484
- "aggregateConditions": [
483
+ "aggregates": {
484
+ "operator": null,
485
+ "aggregateConfig": [
485
486
{
486
- "agg ": "count",
487
- "conditionConfig ": {
488
- "conditions ": [
487
+ "aggregateFunction ": "count",
488
+ "conditions ": {
489
+ "conditionConfig ": [
489
490
{
490
491
"column": "status",
491
492
"operator": ">=",
@@ -499,7 +500,7 @@ func getAlertBody(stream string) string {
499
500
}
500
501
]
501
502
},
502
- "evalType ": {
503
+ "evalConfig ": {
503
504
"rollingWindow": {
504
505
"evalStart": "5m",
505
506
"evalEnd": "now",
@@ -511,7 +512,7 @@ func getAlertBody(stream string) string {
511
512
"type": "webhook",
512
513
"endpoint": "https://webhook.site/ec627445-d52b-44e9-948d-56671df3581e",
513
514
"headers": {},
514
- "skip_tls_check ": true,
515
+ "skipTlsCheck ": true,
515
516
"repeat": {
516
517
"interval": "1m",
517
518
"times": 1
@@ -523,15 +524,15 @@ func getAlertBody(stream string) string {
523
524
524
525
func getIdStateFromAlertResponse (body io.Reader ) (string , string ) {
525
526
type AlertConfig struct {
526
- Severity string `json:"severity"`
527
- Title string `json:"title"`
528
- Id string `json:"id"`
529
- State string `json:"state"`
530
- Query string `json:"query "`
531
- AlertType string `json:"alert_type "`
532
- AggregateConfig string `json:"aggregate_config "`
533
- EvalType string `json:"eval_type "`
534
- Targets string `json:"targets"`
527
+ Severity string `json:"severity"`
528
+ Title string `json:"title"`
529
+ Id string `json:"id"`
530
+ State string `json:"state"`
531
+ Stream string `json:"stream "`
532
+ AlertType string `json:"alertType "`
533
+ Aggregates string `json:"aggregates "`
534
+ EvalConfig string `json:"evalConfig "`
535
+ Targets string `json:"targets"`
535
536
}
536
537
537
538
var response []AlertConfig
@@ -551,30 +552,31 @@ func createAlertResponse(id string, state string, stream string) string {
551
552
"state": "%s",
552
553
"severity": "medium",
553
554
"title": "AlertTitle",
554
- "query ": "SELECT * FROM %s",
555
+ "stream ": "%s",
555
556
"alertType": "threshold",
556
- "aggregateConfig ": {
557
+ "aggregates ": {
557
558
"operator": null,
558
- "aggregateConditions ": [
559
+ "aggregateConfig ": [
559
560
{
560
- "agg ": "count",
561
- "conditionConfig ": {
561
+ "aggregateFunction ": "count",
562
+ "conditions ": {
562
563
"operator": null,
563
- "conditions ": [
564
+ "conditionConfig ": [
564
565
{
565
566
"column": "status",
566
567
"operator": ">=",
567
568
"value": "200"
568
569
}
569
570
]
570
571
},
572
+ "groupBy": null,
571
573
"column": "status",
572
574
"operator": "<=",
573
575
"value": 100
574
576
}
575
577
]
576
578
},
577
- "evalType ": {
579
+ "evalConfig ": {
578
580
"rollingWindow": {
579
581
"evalStart": "5m",
580
582
"evalEnd": "now",
@@ -586,7 +588,7 @@ func createAlertResponse(id string, state string, stream string) string {
586
588
"type": "webhook",
587
589
"endpoint": "https://webhook.site/ec627445-d52b-44e9-948d-56671df3581e",
588
590
"headers": {},
589
- "skip_tls_check ": true,
591
+ "skipTlsCheck ": true,
590
592
"repeat": {
591
593
"interval": "1m",
592
594
"times": 1
0 commit comments