Documentation ¶
Index ¶
- type Alert
- type DB
- func (db *DB) AddAlert(errorPattern string) error
- func (db *DB) AddErrorLog(errPat string, errMsg string, jobName string, prNum int, blogURL string) error
- func (db *DB) DeleteAlert(errorPattern string) error
- func (db *DB) IsFreshAlertPattern(errorPattern string, window time.Duration) (bool, error)
- func (db *DB) IsPatternAlerting(errorPattern, jobPattern string, window time.Duration, aTotal, aJobs, aPRs int) (bool, error)
- func (db *DB) ListAlerts() ([]*Alert, error)
- func (db *DB) ListErrorLogs(errorPattern string, window time.Duration) ([]ErrorLog, error)
- type ErrorLog
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
Alert maps to the Alerts table Table schema: github.com/chizhg/test-infra/tools/monitoring/mysql/schema.sql
type DB ¶
DB holds an active database connection created in `config`
func (*DB) AddAlert ¶
AddAlert inserts a new error pattern and alert time (now) to Alerts table If the pattern already exists, update the alert time
func (*DB) AddErrorLog ¶
func (db *DB) AddErrorLog(errPat string, errMsg string, jobName string, prNum int, blogURL string) error
AddErrorLog insert a new error to the ErrorLogs table
func (*DB) DeleteAlert ¶
DeleteAlert deletes a row (alert) from the Alerts table
func (*DB) IsFreshAlertPattern ¶
IsFreshAlertPattern checks the Alerts table to see if the error pattern hasn't been alerted within the time window
func (*DB) IsPatternAlerting ¶
func (db *DB) IsPatternAlerting(errorPattern, jobPattern string, window time.Duration, aTotal, aJobs, aPRs int) (bool, error)
IsPatternAlerting checks whether the given error pattern meets the alert condition
func (*DB) ListAlerts ¶
ListAlerts returns all error pattern and timestamps in the Alerts table