Documentation ¶
Index ¶
- Constants
- func BuildDuration(duration string) time.Duration
- type EvalGroup
- type EvalRule
- func (e *EvalRule) Eval(ctx context.Context) ([]*agent.Alarm, error)
- func (e *EvalRule) ForEventsAt(startsAt time.Time) bool
- func (e *EvalRule) GetAlert() string
- func (e *EvalRule) GetAnnotations() agent.Annotations
- func (e *EvalRule) GetDatasource() agent.Datasource
- func (e *EvalRule) GetExpr() string
- func (e *EvalRule) GetFor() string
- func (e *EvalRule) GetID() string
- func (e *EvalRule) GetLabels() agent.Labels
- func (e *EvalRule) NewFiringAlarm(ctx context.Context, value *agent.QueryResponse) *agent.Alarm
- func (e *EvalRule) NewFiringAlert(_ context.Context, result *agent.Result) (*agent.Alert, bool)
- func (e *EvalRule) NewResolvedAlarm(_ context.Context, firingAlarm *agent.Alarm) *agent.Alarm
- func (e *EvalRule) SetDatasource(datasource agent.Datasource)
- func (e *EvalRule) SetEventsAt(eventsAt time.Time)
- type Ruler
Constants ¶
View Source
const ( LabelsKeyDatasourceID = "datasourceId" LabelsKeyRuleID = "__alert_id__" LabelsKeyLevelID = "__level_id__" LabelsKeyGroupID = "groupID" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EvalRule ¶
type EvalRule struct { // ID 用作唯一标识 ID string `json:"-"` Alert string `json:"alert"` Expr string `json:"expr"` For string `json:"for"` Labels agent.Labels `json:"labels"` Annotations agent.Annotations `json:"annotations"` // contains filtered or unexported fields }
func (*EvalRule) ForEventsAt ¶
ForEventsAt 断言eventsAt是否在for时间范围内
func (*EvalRule) GetAnnotations ¶
func (e *EvalRule) GetAnnotations() agent.Annotations
func (*EvalRule) GetDatasource ¶
func (e *EvalRule) GetDatasource() agent.Datasource
func (*EvalRule) NewFiringAlarm ¶
NewFiringAlarm 创建告警
func (*EvalRule) NewFiringAlert ¶
NewFiringAlert 创建警报
func (*EvalRule) NewResolvedAlarm ¶
NewResolvedAlarm 合并告警
func (*EvalRule) SetDatasource ¶
func (e *EvalRule) SetDatasource(datasource agent.Datasource)
SetDatasource set datasource
func (*EvalRule) SetEventsAt ¶
SetEventsAt set events at
Click to show internal directories.
Click to hide internal directories.