Skip to content

Commit

Permalink
feature. add attribute type & id to systemNotification
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkfree committed Apr 11, 2024
1 parent c54204c commit 5ddb6ef
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions cmd/server/system_notification_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ import (
)

type RuleAnnotation struct {
CheckPoint string `yaml:"CheckPoint"`
Description string `yaml:"description"`
Discriminative string `yaml:"discriminative"`
Message string `yaml:"message"`
Summary string `yaml:"summary"`
CheckPoint string `yaml:"CheckPoint"`
Description string `yaml:"description"`
Discriminative string `yaml:"discriminative"`
Message string `yaml:"message"`
Summary string `yaml:"summary"`
AlertType string `json:"alertType"`
SystemNotificationRuleId string `json:"systemNotificationRuleId"`
}

type RuleLabels struct {
Expand Down Expand Up @@ -104,10 +106,12 @@ func processSystemNotificationRule() error {
Expr: expr,
For: rule.SystemNotificationCondition.Duration,
Annotations: RuleAnnotation{
CheckPoint: replaceMetricParameter(rule.SystemNotificationTemplate.MetricParameters, rule.MessageActionProposal),
Description: replaceMetricParameter(rule.SystemNotificationTemplate.MetricParameters, rule.MessageContent),
Message: replaceMetricParameter(rule.SystemNotificationTemplate.MetricParameters, rule.MessageTitle),
Discriminative: discriminative,
CheckPoint: replaceMetricParameter(rule.SystemNotificationTemplate.MetricParameters, rule.MessageActionProposal),
Description: replaceMetricParameter(rule.SystemNotificationTemplate.MetricParameters, rule.MessageContent),
Message: replaceMetricParameter(rule.SystemNotificationTemplate.MetricParameters, rule.MessageTitle),
Discriminative: discriminative,
AlertType: rule.NotificationType,

Check failure on line 113 in cmd/server/system_notification_rule.go

View workflow job for this annotation

GitHub Actions / unittest

rule.NotificationType undefined (type systemNotification.SystemNotificationRule has no field or method NotificationType)
SystemNotificationRuleId: rule.ID.String(),
},
Labels: RuleLabels{
Severity: rule.SystemNotificationCondition.Severity,
Expand Down Expand Up @@ -178,7 +182,7 @@ func processSystemNotificationRule() error {
organizationRuleIds = append(organizationRuleIds, r.ID)
}
}
err = systemNotificationRuleAccessor.UpdateSystemNotificationRuleStatus(organizationRuleIds, domain.SystemNotificationRuleStatus_APPLYED)
err = systemNotificationRuleAccessor.UpdateSystemNotificationRuleStatus(organizationRuleIds, domain.SystemNotificationRuleStatus_APPLIED)

Check failure on line 185 in cmd/server/system_notification_rule.go

View workflow job for this annotation

GitHub Actions / unittest

undefined: domain.SystemNotificationRuleStatus_APPLIED
if err != nil {
log.Error(context.TODO(), err)
continue
Expand Down

0 comments on commit 5ddb6ef

Please sign in to comment.