Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertDefinition ¶
type AlertDefinition struct {
ID int64 `xorm:"pk autoincr 'id'" json:"id"`
OrgID int64 `xorm:"org_id" json:"orgId"`
Title string `json:"title"`
Condition string `json:"condition"`
Data []eval.AlertQuery `json:"data"`
Updated time.Time `json:"updated"`
IntervalSeconds int64 `json:"intervalSeconds"`
Version int64 `json:"version"`
UID string `xorm:"uid" json:"uid"`
Paused bool `json:"paused"`
}
AlertDefinition is the model for alert definitions in Alerting NG.
type AlertDefinitionVersion ¶
type AlertDefinitionVersion struct {
ID int64 `xorm:"pk autoincr 'id'"`
AlertDefinitionID int64 `xorm:"alert_definition_id"`
AlertDefinitionUID string `xorm:"alert_definition_uid"`
ParentVersion int64
RestoredFrom int64
Version int64
Created time.Time
Title string
Condition string
Data []eval.AlertQuery
IntervalSeconds int64
}
AlertDefinitionVersion is the model for alert definition versions in Alerting NG.
type AlertInstance ¶
type AlertInstance struct {
DefinitionOrgID int64 `xorm:"def_org_id"`
DefinitionUID string `xorm:"def_uid"`
Labels InstanceLabels
LabelsHash string
CurrentState InstanceStateType
CurrentStateSince time.Time
LastEvalTime time.Time
}
AlertInstance represents a single alert instance.
type AlertNG ¶
type AlertNG struct {
Cfg *setting.Cfg `inject:""`
DatasourceCache datasources.CacheService `inject:""`
RouteRegister routing.RouteRegister `inject:""`
SQLStore *sqlstore.SQLStore `inject:""`
// contains filtered or unexported fields
}
AlertNG is the service for evaluating the condition of an alert definition.
func (*AlertNG) AddMigration ¶
AddMigration defines database migrations. If Alerting NG is not enabled does nothing.
func (*AlertNG) IsDisabled ¶
IsDisabled returns true if the alerting service is disable for this instance.
type InstanceLabels ¶
InstanceLabels is an extension to data.Labels with methods for database serialization.
func (*InstanceLabels) FromDB ¶
func (il *InstanceLabels) FromDB(b []byte) error
FromDB loads labels stored in the database as json tuples into InstanceLabels. FromDB is part of the xorm Conversion interface.
func (*InstanceLabels) StringAndHash ¶
func (il *InstanceLabels) StringAndHash() (string, string, error)
StringAndHash returns a the json representation of the labels as tuples sorted by key. It also returns the a hash of that representation.
func (*InstanceLabels) ToDB ¶
func (il *InstanceLabels) ToDB() ([]byte, error)
ToDB is not implemented as serialization is handled with manual SQL queries). ToDB is part of the xorm Conversion interface.
type InstanceStateType ¶
type InstanceStateType string
InstanceStateType is an enum for instance states.
const ( // InstanceStateFiring is for a firing alert. InstanceStateFiring InstanceStateType = "Alerting" // InstanceStateNormal is for a normal alert. InstanceStateNormal InstanceStateType = "Normal" )
func (InstanceStateType) IsValid ¶
func (i InstanceStateType) IsValid() bool
IsValid checks that the value of InstanceStateType is a valid string.