Compare commits

...

81 Commits

Author SHA1 Message Date
ning
876fe51d33 merge main 2025-03-03 20:49:57 +08:00
ning
3423704817 refactor 2025-03-03 20:43:07 +08:00
ning
8b7b793d00 refactor send tudy 2025-03-03 19:56:21 +08:00
ning
9f78db8208 fix email 2025-03-03 18:18:55 +08:00
ning
f45423bf8d change api 2025-03-03 17:45:20 +08:00
ning
e4dbf3571b change api 2025-03-03 17:32:02 +08:00
ning
5c88b8499b add more log 2025-03-03 17:11:30 +08:00
ning
c07baa7f64 add more log 2025-03-03 16:55:54 +08:00
ning
15f175a5b0 add attributesMatch 2025-03-03 16:32:08 +08:00
ning
515433199a update init notify_channel 2025-03-03 16:13:14 +08:00
ning
45e944f390 change custom params api 2025-03-03 16:06:22 +08:00
ning
9bd18dc2b0 change notify log 2025-03-03 15:00:07 +08:00
ning
d296ea05df update notify channel init 2025-03-03 14:23:47 +08:00
ning
53e6073b0d update notify channel init 2025-03-03 14:20:20 +08:00
ning
c8335d83b0 delete NOTIFYCONTACT 2025-03-03 11:31:37 +08:00
ning
3d882cf1b8 code refactor 2025-03-03 11:06:40 +08:00
ning
ca1271fa87 code refactor 2025-03-03 10:54:01 +08:00
ning
7e981afcd8 code refactor 2025-03-03 00:01:50 +08:00
ning
03a4dbd6ef code refactor 2025-03-02 23:37:42 +08:00
ning
c1ef13d426 change ali-voice 2025-03-02 23:04:45 +08:00
ning
d80ad1d3a9 change alisms 2025-03-02 21:41:49 +08:00
ning
3a69003a4d update tx-voice 2025-03-02 01:36:16 +08:00
ning
beb0a0178f update wecom 2025-03-02 00:52:25 +08:00
ning
4028bee1eb change feishu dingtalk 2025-03-02 00:04:00 +08:00
ning
d2fa012d1f update send http 2025-02-28 19:59:43 +08:00
ning
1fe1418a88 Merge branch 'notify-rule-feat' of github.com:ccfos/nightingale into notify-rule-feat 2025-02-28 19:26:20 +08:00
ning
f6d79eb2f0 change update alert_rule 2025-02-28 19:25:29 +08:00
Xu Bin
d87a313b31 chagne notify test api (#2497) 2025-02-28 19:10:54 +08:00
ning
5d107e520a code refactor 2025-02-28 18:59:56 +08:00
ning
a0c58ddccd update migrate 2025-02-28 18:53:33 +08:00
ning
6d04bf3682 code refactor 2025-02-28 17:31:02 +08:00
ning
29ff1ba0fe code refactor 2025-02-28 17:17:44 +08:00
ning
0687cd5ecf code refactor 2025-02-28 16:36:20 +08:00
ning
3a4113b085 code refactor 2025-02-28 16:26:00 +08:00
ning
5ffdebbdfc code refactor 2025-02-28 14:20:38 +08:00
ning
a7e035a7ad fix get duty channel id 2025-02-27 17:41:44 +08:00
ning
f764b095e2 code refactor 2025-02-27 17:12:13 +08:00
ning
2705b5ea04 fix get duty channel list 2025-02-27 16:48:11 +08:00
ning
a6c78f900b code refactor 2025-02-27 16:10:56 +08:00
ning
830a39c124 code refactor 2025-02-27 16:03:25 +08:00
Xu Bin
8968c5c854 notify mute and test api (#2493) 2025-02-27 15:55:23 +08:00
ning
7da32ef114 add notify tpl 2025-02-27 15:49:51 +08:00
ning
03e90a9e73 add notify tpl 2025-02-27 15:28:45 +08:00
ning
9555fe09bc update tpl 2025-02-27 12:20:07 +08:00
ning
934af7040f change custom param 2025-02-27 11:12:28 +08:00
ning
87de275c35 change param config 2025-02-27 10:50:54 +08:00
ning
1f130b2af4 code refactor 2025-02-26 20:41:05 +08:00
ning
3b74cefaa9 change inner tpl 2025-02-26 20:39:10 +08:00
ning
37ca580ce8 change gomod 2025-02-26 20:02:32 +08:00
ning
21938ffd11 change gomod 2025-02-26 18:41:36 +08:00
ning
34c26d0f5a code refactor 2025-02-26 17:36:49 +08:00
710leo
d24734975b add event notify_rule_ids 2025-02-25 23:23:35 +08:00
710leo
3e93af67c5 code refactor 2025-02-25 23:18:06 +08:00
710leo
5fc664ccd8 add unit test 2025-02-25 23:09:30 +08:00
710leo
4a74a7492d change var name 2025-02-25 22:12:06 +08:00
ning
0184f378da refactor notify channel config 2025-02-25 21:10:24 +08:00
Xu Bin
8844d4d07b notify record and concurrency control for http (#2488) 2025-02-25 20:15:57 +08:00
ning
1a3b80b92c code refactor 2025-02-24 17:22:01 +08:00
ning
66e654142e code refactor 2025-02-24 17:09:13 +08:00
ning
d272719644 Merge branch 'notify-rule-feat' of github.com:ccfos/nightingale into notify-rule-feat 2025-02-24 16:51:06 +08:00
ning
75a552748d fix: update alert rule fields 2025-02-24 16:50:34 +08:00
Xu Bin
19fa5c0199 refactor: update notify channel send (#2484) 2025-02-24 15:45:32 +08:00
ning
0416f4a3f2 merge main 2025-02-24 14:17:27 +08:00
ning
04d960d791 fix build 2025-02-24 13:13:20 +08:00
Xu Bin
7585ed1613 new notify process (#2464)
Co-authored-by: Yening Qin <710leo@gmail.com>
2025-02-24 12:13:34 +08:00
ning
2f5d5183cd add notify_version 2025-02-24 11:49:59 +08:00
ning
f4598dda51 code refactor 2025-02-21 19:21:20 +08:00
ning
0e9a8e2871 code refactor 2025-02-21 18:10:27 +08:00
ning
6060c485d2 fix build 2025-02-21 18:02:08 +08:00
flashbo
b21f4e7c4f Notify rule feat (#2481) 2025-02-21 17:56:11 +08:00
ning
18958cc5ad update message_template api 2025-02-21 17:49:29 +08:00
ning
f81f16db39 update ops 2025-02-21 17:11:43 +08:00
ning
c95c983560 alert rule add notify_rule_ids 2025-02-21 16:50:25 +08:00
flashbo
89ac620ec6 refactor: notify rule api (#2478) 2025-02-21 14:14:35 +08:00
flashbo
e04d89d604 crud for message template, notify rule and notify channel (#2472) 2025-02-19 09:27:46 +08:00
ning
aff56824ca change id type 2025-02-14 18:10:59 +08:00
flashbo
19d5c17f17 crud for message template, notify rule and notify channel (#2462) 2025-02-14 18:05:45 +08:00
ning
c89a8042dd code refactor 2025-01-22 14:43:50 +08:00
ning
a5a017b1ab code refactor 2025-01-22 14:40:34 +08:00
ning
4f103c3908 Merge branch 'main' of github.com:ccfos/nightingale into notify-rule-feat 2025-01-22 14:37:00 +08:00
ning
aba02c565f data model 2025-01-21 11:30:22 +08:00
4 changed files with 14 additions and 3 deletions

View File

@@ -291,6 +291,7 @@ func GetNotifyConfigParams(notifyConfig *models.NotifyConfig, userCache *memsto.
visited[user.Id] = true
userInfos = append(userInfos, user)
}
userGroups := userGroupCache.GetByUserGroupIds(userInfoParams.UserGroupIDs)
for _, userGroup := range userGroups {
for _, user := range userGroup.Users {
@@ -311,7 +312,10 @@ func (e *Dispatch) sendV2(events []*models.AlertCurEvent, notifyRuleId int64, no
return
}
tplContent := messageTemplate.RenderEvent(events)
tplContent := make(map[string]string)
if notifyChannel.RequestType != "flashduty" {
tplContent = messageTemplate.RenderEvent(events)
}
userInfos, flashDutyChannelIDs, customParams := GetNotifyConfigParams(notifyConfig, e.userCache, e.userGroupCache)
@@ -343,7 +347,7 @@ func (e *Dispatch) sendV2(events []*models.AlertCurEvent, notifyRuleId int64, no
sender.NotifyRecord(e.ctx, events, notifyRuleId, notifyChannel.Name, notifyChannel.RequestConfig.HTTPRequestConfig.URL, respBody, err)
}
case "email":
case "smtp":
err := notifyChannel.SendEmail(events, tplContent, userInfos, e.notifyChannelCache.GetSmtpClient(notifyChannel.ID))
if err != nil {
logger.Errorf("send email error: %v", err)

View File

@@ -172,7 +172,7 @@ func (ncc *NotifyChannelCacheType) syncNotifyChannels() error {
// todo 优化变更粒度
switch lst[i].RequestType {
case "http":
case "http", "flashduty":
if lst[i].RequestConfig == nil || lst[i].RequestConfig.HTTPRequestConfig == nil {
logger.Warningf("notify channel %+v http request config not found", lst[i])
continue

View File

@@ -597,6 +597,9 @@ func (t *MessageTemplate) Upsert(ctx *ctx.Context, ident string) error {
}
func (t *MessageTemplate) RenderEvent(events []*AlertCurEvent) map[string]string {
if t == nil {
return nil
}
// event 内容渲染到 messageTemplate
tplContent := make(map[string]string)
for key, msgTpl := range t.Content {

View File

@@ -409,6 +409,7 @@ func (ncc *NotifyChannelConfig) SendFlashDuty(events []*AlertCurEvent, flashDuty
query := req.URL.Query()
query.Add("channel_id", strconv.FormatInt(flashDutyChannelID, 10))
req.URL.RawQuery = query.Encode()
req.Header.Add("Content-Type", "application/json")
// 重试机制
for i := 0; i <= 3; i++ {
@@ -1146,6 +1147,9 @@ var NotiChMap = map[string]*NotifyChannelConfig{
RequestConfig: &RequestConfig{
HTTPRequestConfig: &HTTPRequestConfig{
Timeout: 10000, Concurrency: 5, RetryTimes: 3, RetryInterval: 100,
Headers: map[string]string{
"Content-Type": "application/json",
},
},
FlashDutyRequestConfig: &FlashDutyRequestConfig{
IntegrationUrl: "flashduty integration url",