Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoSendNotification ¶
func DoSendNotification(alert AlertNotification) error
DoSendNotification is to send the alert to the specified implemenation of the AlertNoticication interface
Types ¶
type Alert ¶
Alert struct for specify the ignoring error and the occuring error
func NewAlertWithExpandos ¶ added in v1.0.5
NewAlertWithExpandos creates Alert struct instance with expandos
func (*Alert) RemoveCurrentThrotting ¶
RemoveCurrentThrotting remove all current throttlings.
type AlertNotification ¶
type AlertNotification interface {
Send() error
}
AlertNotification is interface that all send notification function satify including send email
type EmailConfig ¶
type EmailConfig struct {
Username string
Password string
Host string
Port string
Sender string
EnvelopeFrom string
Receivers []string // Can use comma for multiple email
Subject string
ErrorObj error
Expandos *Expandos // can modify mail subject and content on demand
}
EmailConfig is email setting struct
func NewEmailConfig ¶
func NewEmailConfig(err error, expandos *Expandos) EmailConfig
NewEmailConfig create new EmailConfig struct
type ErrorOccurrence ¶
ErrorOccurrence store error time and error
type Expandos ¶ added in v1.0.5
type Expandos struct {
EmailBody string
EmailSubject string
MsTeamsAlertCardSubject string
MsTeamsCardSubject string
MsTeamsError string
}
Expandos struct for body and subject
type FactStruct ¶
FactStruct is sub-struct of SectionStruct
type MsTeam ¶
type MsTeam struct {
Type string `json:"@type"`
Context string `json:"@context"`
Summary string `json:"summary"`
ThemeColor string `json:"themeColor"`
Title string `json:"title"`
Sections []SectionStruct `json:"sections"`
}
MsTeam is MessageCard for Team notification
type SectionStruct ¶
type SectionStruct struct {
ActivityTitle string `json:"activityTitle"`
ActivitySubtitle string `json:"activitySubtitle"`
ActivityImage string `json:"activityImage"`
Facts []FactStruct `json:"facts"`
}
SectionStruct is sub-struct of MsTeam
type Throttler ¶
Throttler struct storing disckage directory and Throttling duration
func NewThrottler ¶
func NewThrottler() Throttler
NewThrottler constructs new Throttle struct and init diskcache directory
func (*Throttler) CleanThrottlingCache ¶
CleanThrottlingCache clean all the diskcache in throttling cache directory
func (*Throttler) InitGrace ¶ added in v1.1.2
ThrottleError throttle the alert within the limited duration
func (*Throttler) IsThrottledOrGraced ¶ added in v1.1.2
IsThrottled checks if the error has been throttled. If not, throttle it
func (*Throttler) ThrottleError ¶
ThrottleError throttle the alert within the limited duration