Amol Umbark 3a287b2b16
Alerts backend with metrics (#1346)
Alerts backend with metrics
2022-07-14 11:59:06 +05:30

36 lines
885 B
Go

package rules
import (
"context"
"go.signoz.io/query-service/utils/labels"
"time"
)
// A Rule encapsulates a vector expression which is evaluated at a specified
// interval and acted upon (currently used for alerting).
type Rule interface {
ID() string
Name() string
Type() RuleType
Labels() labels.BaseLabels
Annotations() labels.BaseLabels
Condition() *RuleCondition
State() AlertState
ActiveAlerts() []*Alert
Eval(context.Context, time.Time, *Queriers) (interface{}, error)
String() string
// Query() string
SetLastError(error)
LastError() error
SetHealth(RuleHealth)
Health() RuleHealth
SetEvaluationDuration(time.Duration)
GetEvaluationDuration() time.Duration
SetEvaluationTimestamp(time.Time)
GetEvaluationTimestamp() time.Time
SendAlerts(ctx context.Context, ts time.Time, resendDelay time.Duration, interval time.Duration, notifyFunc NotifyFunc)
}