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 ¶
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 ¶
type Expandos struct { EmailBody string EmailSubject string MsTeamsAlertCardSubject string MsTeamsCardSubject string MsTeamsError string }
Expandos struct for body and subject
type MsTeam ¶
type MsTeam struct { Type string `json:"type"` Attachments []attachment `json:"attachments"` }
MsTeam is Adaptive Card for Team notification
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) IsThrottledOrGraced ¶
IsThrottled checks if the error has been throttled. If not, throttle it
func (*Throttler) ThrottleError ¶
ThrottleError throttle the alert within the limited duration