alerting: golint fixes for alert notifiers. (#17167)

This commit is contained in:
Carl Bergquist
2019-05-20 15:23:06 +02:00
committed by GitHub
parent a0f5923b95
commit bfa7c3d963
30 changed files with 356 additions and 292 deletions
+15 -3
View File
@@ -13,10 +13,11 @@ const (
triggMetrString = "Triggered metrics:\n\n"
)
// NotifierBase is the base implementation of a notifier.
type NotifierBase struct {
Name string
Type string
Uid string
UID string
IsDeault bool
UploadImage bool
SendReminder bool
@@ -26,6 +27,7 @@ type NotifierBase struct {
log log.Logger
}
// NewNotifierBase returns a new `NotifierBase`.
func NewNotifierBase(model *models.AlertNotification) NotifierBase {
uploadImage := true
value, exist := model.Settings.CheckGet("uploadImage")
@@ -34,7 +36,7 @@ func NewNotifierBase(model *models.AlertNotification) NotifierBase {
}
return NotifierBase{
Uid: model.Uid,
UID: model.Uid,
Name: model.Name,
IsDeault: model.IsDefault,
Type: model.Type,
@@ -108,30 +110,40 @@ func (n *NotifierBase) ShouldNotify(ctx context.Context, context *alerting.EvalC
return true
}
// GetType returns the notifier type.
func (n *NotifierBase) GetType() string {
return n.Type
}
// NeedsImage returns true if an image is expected in the notification.
func (n *NotifierBase) NeedsImage() bool {
return n.UploadImage
}
// GetNotifierUid returns the notifier `uid`.
func (n *NotifierBase) GetNotifierUid() string {
return n.Uid
return n.UID
}
// GetIsDefault returns true if the notifiers should
// be used for all alerts.
func (n *NotifierBase) GetIsDefault() bool {
return n.IsDeault
}
// GetSendReminder returns true if reminders should be sent.
func (n *NotifierBase) GetSendReminder() bool {
return n.SendReminder
}
// GetDisableResolveMessage returns true if ok alert notifications
// should be skipped.
func (n *NotifierBase) GetDisableResolveMessage() bool {
return n.DisableResolveMessage
}
// GetFrequency returns the freqency for how often
// alerts should be evaluated.
func (n *NotifierBase) GetFrequency() time.Duration {
return n.Frequency
}