🪄mutelabel生成

This commit is contained in:
Akkia
2023-04-16 22:47:12 +08:00
parent e5704157e3
commit b444a94a06
2 changed files with 10 additions and 5 deletions

View File

@@ -106,7 +106,7 @@ func OnDeleteNotification(id uint64) {
func SendNotification(notificationTag string, desc string, muteLabel *string, ext ...*model.Server) {
if muteLabel != nil {
// 将通知方式组名称加入静音标志
muteLabel := fmt.Sprintf("%s:%s", *muteLabel, notificationTag)
muteLabel := *NotificationMuteLabel.AppendNotificationTag(muteLabel, notificationTag)
// 通知防骚扰策略
var flag bool
if cacheN, has := Cache.Get(muteLabel); has {
@@ -179,6 +179,11 @@ func (_NotificationMuteLabel) ServerIncidentResolved(alertId uint64, serverId ui
return &label
}
func (_NotificationMuteLabel) AppendNotificationTag(label *string, notificationTag string) *string {
newLabel := fmt.Sprintf("%s:%s", *label, notificationTag)
return &newLabel
}
func (_NotificationMuteLabel) ServiceLatencyMin(serviceId uint64) *string {
label := fmt.Sprintf("bf::sln-%d", serviceId)
return &label