Skip to content

Commit 052aaad

Browse files
authored
changes in alert request body (#105)
1 parent 69c4397 commit 052aaad

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

model.go

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ func Roleingestor(stream string) string {
475475

476476
func getTargetBody() string {
477477
return ` {
478+
"name":"targetName",
478479
"type": "webhook",
479480
"endpoint": "https://webhook.site/ec627445-d52b-44e9-948d-56671df3581e",
480481
"headers": {},
@@ -489,12 +490,8 @@ func getTargetBody() string {
489490

490491
func getIdFromTargetResponse(body io.Reader) string {
491492
type TargetConf struct {
492-
Type string `json:"type"`
493-
Endpoint string `json:"endpoint"`
494-
Headers string `json:"headers"`
495-
SkipTlsCheck string `json:"skipTlsCheck"`
496-
Repeat string `json:"repeat"`
497-
Id string `json:"id"`
493+
Type string `json:"type"`
494+
Id string `json:"id"`
498495
}
499496
var response []TargetConf
500497
if err := json.NewDecoder(body).Decode(&response); err != nil {
@@ -520,14 +517,14 @@ func getAlertBody(stream string, targetId string) string {
520517
"conditions": {
521518
"conditionConfig": [
522519
{
523-
"column": "status",
524-
"operator": ">=",
525-
"value": "200"
520+
"column": "level",
521+
"operator": "=",
522+
"value": "info"
526523
}
527524
]
528525
},
529-
"column": "status",
530-
"operator": "<=",
526+
"column": "level",
527+
"operator": "=",
531528
"value": 100
532529
}
533530
]
@@ -586,15 +583,15 @@ func createAlertResponse(id string, state string, stream string, targetId string
586583
"operator": null,
587584
"conditionConfig": [
588585
{
589-
"column": "status",
590-
"operator": ">=",
591-
"value": "200"
586+
"column": "level",
587+
"operator": "=",
588+
"value": "info"
592589
}
593590
]
594591
},
595592
"groupBy": null,
596-
"column": "status",
597-
"operator": "<=",
593+
"column": "level",
594+
"operator": "=",
598595
"value": 100
599596
}
600597
]

0 commit comments

Comments
 (0)