Documentation ¶
Index ¶
- Constants
- func NewGormLogrusLogger(logger *logrus.Entry, slowLogThreshold time.Duration) logger.Interface
- type Alert
- type AlertDetails
- type AlertHistoryDetails
- type AlertLabel
- type AlertQueryCondition
- type AlertState
- type Contact
- type LogLinesEntry
- type LogLinesFile
- type MinionSearch
- type Notification
- type QueryParams
- type SlackTokenConfig
- type WebHookConfig
- type WebhookBody
Constants ¶
View Source
const ( Inactive AlertState = iota Pending Firing SystemGeneratedAlert = "System Generated" UserModified = "User Modified" AlertFiring = "Alert Firing" AlertNormal = "Alert Normal" ConfigChange = "Config Modified" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlertDetails ¶
type AlertDetails struct { AlertId string `json:"alert_id" gorm:"primaryKey"` AlertName string `json:"alert_name" gorm:"not null;unique"` State AlertState `json:"state"` CreateTimestamp time.Time `json:"create_timestamp" gorm:"autoCreateTime:milli" ` ContactID string `json:"contact_id" gorm:"foreignKey:ContactId;"` ContactName string `json:"contact_name"` Labels []AlertLabel `json:"labels" gorm:"many2many:label_alerts"` SilenceMinutes uint64 `json:"silence_minutes"` QueryParams QueryParams `json:"queryParams" gorm:"embedded"` Condition AlertQueryCondition `json:"condition"` Value float32 `json:"value"` EvalFor uint64 `json:"eval_for"` EvalInterval uint64 `json:"eval_interval"` Message string `json:"message"` CronJob gocron.Job `json:"cron_job" gorm:"embedded"` NodeId uint64 `json:"node_id"` NotificationID string `json:"notification_id" gorm:"foreignKey:NotificationId;"` OrgId uint64 `json:"org_id"` }
func (AlertDetails) TableName ¶
func (AlertDetails) TableName() string
type AlertHistoryDetails ¶
type AlertHistoryDetails struct { ID uint `gorm:"primaryKey;autoIncrement:true"` AlertId string `json:"alert_id"` EventDescription string `json:"event_description"` UserName string `json:"user_name"` EventTriggeredAt time.Time `json:"event_triggered_at"` }
func (AlertHistoryDetails) TableName ¶
func (AlertHistoryDetails) TableName() string
type AlertLabel ¶
type AlertLabel struct { LabelName string `json:"label_name" gorm:"primaryKey;size:256;not null;"` //unique LabelValue string `json:"label_value"` }
func (AlertLabel) TableName ¶
func (AlertLabel) TableName() string
TableName overrides the default tablename generated by GORM
type AlertQueryCondition ¶
type AlertQueryCondition uint8 // condition for the alert queries
const ( IsAbove AlertQueryCondition = iota IsBelow IsEqualTo IsNotEqualTo HasNoValue )
type AlertState ¶
type AlertState uint8 // state of the alerts
type Contact ¶
type Contact struct { ContactId string `json:"contact_id" gorm:"primaryKey"` ContactName string `json:"contact_name" gorm:"not null;unique"` Email []string `json:"email" gorm:"type:text[]"` Slack []SlackTokenConfig `json:"slack" gorm:"many2many:slack_contact;auto_preload"` PagerDuty string `json:"pager_duty"` Webhook []WebHookConfig `json:"webhook" gorm:"many2many:webhook_contact;auto_preload"` OrgId uint64 `json:"org_id"` }
type LogLinesEntry ¶
type LogLinesEntry struct { Repository string `json:"repository,omitempty"` Filename string `json:"filename,omitempty"` LineNumber int `json:"line_number,omitempty"` LogText string `json:"log_text,omitempty"` LogTextHash string `json:"log_text_hash,omitempty"` QueryLanguage string `json:"query_language,omitempty"` Query string `json:"query,omitempty"` Condition string `json:"condition,omitempty"` Value int `json:"value,omitempty"` LogLevel string `json:"log_level,omitempty"` }
This MUST be synced with how https://github.com/sigscalr/logminion structures its output JSON.
type LogLinesFile ¶
type LogLinesFile struct { Version string `json:"version,omitempty"` LogAlerts []LogLinesEntry `json:"log_alerts,omitempty"` }
This MUST be synced with how https://github.com/sigscalr/logminion structures its output JSON.
type MinionSearch ¶
type MinionSearch struct { AlertId string `json:"alert_id" gorm:"primaryKey"` AlertName string `json:"alert_name" gorm:"not null;unique"` State AlertState `json:"state"` CreateTimestamp time.Time `json:"create_timestamp" gorm:"autoCreateTime:milli" ` ContactID string `json:"contact_id" gorm:"foreignKey:ContactId;"` ContactName string `json:"contact_name"` Labels []AlertLabel `json:"labels" gorm:"many2many:label_alerts"` SilenceMinutes uint64 `json:"silence_minutes"` QueryParams QueryParams `json:"queryParams" gorm:"embedded"` Condition AlertQueryCondition `json:"condition"` Value float32 `json:"value"` EvalFor uint64 `json:"eval_for"` EvalInterval uint64 `json:"eval_interval"` Message string `json:"message"` CronJob gocron.Job `json:"cron_job" gorm:"embedded"` NodeId uint64 `json:"node_id"` Repository string `json:"repository,omitempty"` Filename string `json:"filename,omitempty"` LineNumber int `json:"line_number,omitempty"` LogText string `json:"log_text,omitempty"` LogTextHash string `json:"log_text_hash,omitempty"` LogLevel string `json:"log_level,omitempty"` OrgId uint64 `json:"org_id"` }
func (MinionSearch) TableName ¶
func (MinionSearch) TableName() string
type Notification ¶
type Notification struct { NotificationId string `json:"notification_id" gorm:"primaryKey"` CooldownPeriod uint64 `json:"cooldown_period"` LastSentTime time.Time `json:"last_sent_time"` AlertId string `json:"-"` }
func (Notification) TableName ¶
func (Notification) TableName() string
type QueryParams ¶
type SlackTokenConfig ¶
type SlackTokenConfig struct { ID uint `gorm:"primaryKey;autoIncrement:true"` ChannelId string `json:"channel_id"` SlToken string `json:"slack_token"` }
func (SlackTokenConfig) TableName ¶
func (SlackTokenConfig) TableName() string
type WebHookConfig ¶
type WebHookConfig struct { ID uint `gorm:"primaryKey;autoIncrement:true"` Webhook string `json:"webhook"` }
func (WebHookConfig) TableName ¶
func (WebHookConfig) TableName() string
Click to show internal directories.
Click to hide internal directories.