修复bug
This commit is contained in:
@@ -123,8 +123,10 @@ func (t *AlarmNotificationTask) parseParameters(ctx context.Context) error {
|
||||
return
|
||||
}
|
||||
|
||||
var params AlarmNotificationTaskParams
|
||||
err = t.taskLog.Task.ParseParameters(¶ms)
|
||||
params := AlarmNotificationTaskParams{
|
||||
NotificationIntervals: make(map[models.SeverityLevel]uint32),
|
||||
}
|
||||
err = t.taskLog.Task.ParseParameters(¶ms.NotificationIntervals)
|
||||
if err != nil {
|
||||
logger.Errorf("任务 %v: 解析参数失败: %v", t.taskLog.TaskID, err)
|
||||
err = fmt.Errorf("任务 %v: 解析参数失败: %v", t.taskLog.TaskID, err)
|
||||
|
||||
@@ -209,20 +209,20 @@ type CollectionConfig struct {
|
||||
}
|
||||
|
||||
type NotificationIntervalsConfig struct {
|
||||
// DebugIntervalMinutes Debug级别告警的通知间隔(分钟)
|
||||
DebugIntervalMinutes uint32 `yaml:"debug"`
|
||||
// InfoIntervalMinutes Info级别告警的通知间隔(分钟)
|
||||
InfoIntervalMinutes uint32 `yaml:"info"`
|
||||
// WarnIntervalMinutes Warn级别告警的通知间隔(分钟)
|
||||
WarnIntervalMinutes uint32 `yaml:"warn"`
|
||||
// ErrorIntervalMinutes Error级别告警的通知间隔(分钟)
|
||||
ErrorIntervalMinutes uint32 `yaml:"error"`
|
||||
// DPanicIntervalMinutes DPanic级别告警的通知间隔(分钟)
|
||||
DPanicIntervalMinutes uint32 `yaml:"dpanic"`
|
||||
// PanicIntervalMinutes Panic级别告警的通知间隔(分钟)
|
||||
PanicIntervalMinutes uint32 `yaml:"panic"`
|
||||
// FatalIntervalMinutes Fatal级别告警的通知间隔(分钟)
|
||||
FatalIntervalMinutes uint32 `yaml:"fatal"`
|
||||
// Debug Debug级别告警的通知间隔(分钟)
|
||||
Debug uint32 `yaml:"debug" json:"debug,omitempty"`
|
||||
// Info Info级别告警的通知间隔(分钟)
|
||||
Info uint32 `yaml:"info" json:"info,omitempty"`
|
||||
// Warn Warn级别告警的通知间隔(分钟)
|
||||
Warn uint32 `yaml:"warn" json:"warn,omitempty"`
|
||||
// Error Error级别告警的通知间隔(分钟)
|
||||
Error uint32 `yaml:"error" json:"error,omitempty"`
|
||||
// DPanic DPanic级别告警的通知间隔(分钟)
|
||||
DPanic uint32 `yaml:"dpanic" json:"dpanic,omitempty"`
|
||||
// Panic Panic级别告警的通知间隔(分钟)
|
||||
Panic uint32 `yaml:"panic" json:"panic,omitempty"`
|
||||
// Fatal Fatal级别告警的通知间隔(分钟)
|
||||
Fatal uint32 `yaml:"fatal" json:"fatal,omitempty"`
|
||||
}
|
||||
|
||||
// AlarmNotificationConfig 告警通知配置
|
||||
|
||||
@@ -152,19 +152,19 @@ type SeverityLevel string
|
||||
|
||||
const (
|
||||
// DebugLevel 调试级别,用于开发和诊断问题。
|
||||
DebugLevel SeverityLevel = "Debug"
|
||||
DebugLevel SeverityLevel = "debug"
|
||||
// InfoLevel 信息级别,用于记录常规操作。
|
||||
InfoLevel SeverityLevel = "Info"
|
||||
InfoLevel SeverityLevel = "info"
|
||||
// WarnLevel 警告级别,表示出现潜在问题,需要关注。
|
||||
WarnLevel SeverityLevel = "Warn"
|
||||
WarnLevel SeverityLevel = "warn"
|
||||
// ErrorLevel 错误级别,表示发生了需要处理的错误。
|
||||
ErrorLevel SeverityLevel = "Error"
|
||||
ErrorLevel SeverityLevel = "error"
|
||||
// DPanicLevel 开发时崩溃级别,在开发模式下会触发 panic。
|
||||
DPanicLevel SeverityLevel = "DPanic"
|
||||
DPanicLevel SeverityLevel = "dpanic"
|
||||
// PanicLevel 崩溃级别,记录日志后会立即触发 panic。
|
||||
PanicLevel SeverityLevel = "Panic"
|
||||
PanicLevel SeverityLevel = "panic"
|
||||
// FatalLevel 致命级别,记录日志后会调用 os.Exit(1) 退出程序。
|
||||
FatalLevel SeverityLevel = "Fatal"
|
||||
FatalLevel SeverityLevel = "fatal"
|
||||
)
|
||||
|
||||
// ToZapLevel 将我们的自定义级别转换为 zapcore.Level,以便与日志记录器兼容。
|
||||
|
||||
Reference in New Issue
Block a user