Versions in this module Expand all Collapse all v2 v2.13.1 Oct 8, 2023 Changes in this version + type Alert struct + ActiveAt time.Time + Annotations labels.Labels + FiredAt time.Time + Labels labels.Labels + LastSentAt time.Time + ResolvedAt time.Time + State AlertState + ValidUntil time.Time + Value float64 + type AlertState int + const StateFiring + const StateInactive + const StatePending + func (s AlertState) String() string + type AlertingRule struct + func NewAlertingRule(name string, vec promql.Expr, hold time.Duration, ...) *AlertingRule + func (r *AlertingRule) ActiveAlerts() []*Alert + func (r *AlertingRule) Annotations() labels.Labels + func (r *AlertingRule) Duration() time.Duration + func (r *AlertingRule) Eval(ctx context.Context, ts time.Time, query QueryFunc, externalURL *url.URL) (promql.Vector, error) + func (r *AlertingRule) ForEachActiveAlert(f func(*Alert)) + func (r *AlertingRule) GetEvaluationDuration() time.Duration + func (r *AlertingRule) GetEvaluationTimestamp() time.Time + func (r *AlertingRule) HTMLSnippet(pathPrefix string) html_template.HTML + func (r *AlertingRule) Health() RuleHealth + func (r *AlertingRule) HoldDuration() time.Duration + func (r *AlertingRule) Labels() labels.Labels + func (r *AlertingRule) LastError() error + func (r *AlertingRule) Name() string + func (r *AlertingRule) Query() promql.Expr + func (r *AlertingRule) SetEvaluationDuration(dur time.Duration) + func (r *AlertingRule) SetEvaluationTimestamp(ts time.Time) + func (r *AlertingRule) SetHealth(health RuleHealth) + func (r *AlertingRule) SetLastError(err error) + func (r *AlertingRule) SetRestored(restored bool) + func (r *AlertingRule) State() AlertState + func (r *AlertingRule) String() string + type Appendable interface + Appender func() (storage.Appender, error) + type Group struct + func NewGroup(name, file string, interval time.Duration, rules []Rule, shouldRestore bool, ...) *Group + func (g *Group) AlertingRules() []*AlertingRule + func (g *Group) CopyState(from *Group) + func (g *Group) Eval(ctx context.Context, ts time.Time) + func (g *Group) File() string + func (g *Group) GetEvaluationDuration() time.Duration + func (g *Group) GetEvaluationTimestamp() time.Time + func (g *Group) HasAlertingRules() bool + func (g *Group) Interval() time.Duration + func (g *Group) Name() string + func (g *Group) RestoreForState(ts time.Time) + func (g *Group) Rules() []Rule + type Manager struct + func NewManager(o *ManagerOptions) *Manager + func (m *Manager) AlertingRules() []*AlertingRule + func (m *Manager) Collect(ch chan<- prometheus.Metric) + func (m *Manager) Describe(ch chan<- *prometheus.Desc) + func (m *Manager) LoadGroups(interval time.Duration, externalLabels labels.Labels, filenames ...string) (map[string]*Group, []error) + func (m *Manager) RuleGroups() []*Group + func (m *Manager) Rules() []Rule + func (m *Manager) Run() + func (m *Manager) Stop() + func (m *Manager) Update(interval time.Duration, files []string, externalLabels labels.Labels) error + type ManagerOptions struct + Appendable Appendable + Context context.Context + ExternalURL *url.URL + ForGracePeriod time.Duration + Logger log.Logger + Metrics *Metrics + NotifyFunc NotifyFunc + OutageTolerance time.Duration + QueryFunc QueryFunc + Registerer prometheus.Registerer + ResendDelay time.Duration + TSDB storage.Storage + type Metrics struct + func NewGroupMetrics(reg prometheus.Registerer) *Metrics + type NotifyFunc func(ctx context.Context, expr string, alerts ...*Alert) + type QueryFunc func(ctx context.Context, q string, t time.Time) (promql.Vector, error) + func EngineQueryFunc(engine *promql.Engine, q storage.Queryable) QueryFunc + type RecordingRule struct + func NewRecordingRule(name string, vector promql.Expr, lset labels.Labels) *RecordingRule + func (rule *RecordingRule) Eval(ctx context.Context, ts time.Time, query QueryFunc, _ *url.URL) (promql.Vector, error) + func (rule *RecordingRule) GetEvaluationDuration() time.Duration + func (rule *RecordingRule) GetEvaluationTimestamp() time.Time + func (rule *RecordingRule) HTMLSnippet(pathPrefix string) template.HTML + func (rule *RecordingRule) Health() RuleHealth + func (rule *RecordingRule) Labels() labels.Labels + func (rule *RecordingRule) LastError() error + func (rule *RecordingRule) Name() string + func (rule *RecordingRule) Query() promql.Expr + func (rule *RecordingRule) SetEvaluationDuration(dur time.Duration) + func (rule *RecordingRule) SetEvaluationTimestamp(ts time.Time) + func (rule *RecordingRule) SetHealth(health RuleHealth) + func (rule *RecordingRule) SetLastError(err error) + func (rule *RecordingRule) String() string + type Rule interface + Eval func(context.Context, time.Time, QueryFunc, *url.URL) (promql.Vector, error) + GetEvaluationDuration func() time.Duration + GetEvaluationTimestamp func() time.Time + HTMLSnippet func(pathPrefix string) html_template.HTML + Health func() RuleHealth + Labels func() labels.Labels + LastError func() error + Name func() string + SetEvaluationDuration func(time.Duration) + SetEvaluationTimestamp func(time.Time) + SetHealth func(RuleHealth) + SetLastError func(error) + String func() string + type RuleHealth string + const HealthBad + const HealthGood + const HealthUnknown Other modules containing this package github.com/zpascal/prometheus