Versions in this module Expand all Collapse all v2 v2.4.3 Feb 9, 2022 Changes in this version + var ErrBadRuleGroup = errors.New("unable to decoded rule group") + var ErrIntOverflowRuler = fmt.Errorf("proto: integer overflow") + var ErrInvalidLengthRuler = fmt.Errorf("proto: negative length found during unmarshaling") + var ErrNoGroupName = errors.New("a matching group name must be provided in the request") + var ErrNoNamespace = errors.New("a namespace must be provided in the request") + var ErrNoRuleGroups = errors.New("no rule groups found") + var RingOp = ring.NewOp([]ring.InstanceState{ ... }, func(s ring.InstanceState) bool { ... }) + func EngineQueryFunc(engine *promql.Engine, q storage.Queryable, overrides RulesLimits, ...) rules.QueryFunc + func MetricsQueryFunc(qf rules.QueryFunc, queries, failedQueries prometheus.Counter) rules.QueryFunc + func NewLegacyRuleStore(cfg RuleStoreConfig, hedgeCfg hedging.Config, ...) (rulestore.RuleStore, error) + func NewRuleStore(ctx context.Context, cfg rulestore.Config, ...) (rulestore.RuleStore, error) + func RecordAndReportRuleQueryMetrics(qf rules.QueryFunc, queryTime prometheus.Counter, logger log.Logger) rules.QueryFunc + func RegisterRulerServer(s *grpc.Server, srv RulerServer) + func SendAlerts(n sender, externalURL string) promRules.NotifyFunc + func WrapQueryableErrors(err error) error + type API struct + func NewAPI(r *Ruler, s rulestore.RuleStore, logger log.Logger) *API + func (a *API) CreateRuleGroup(w http.ResponseWriter, req *http.Request) + func (a *API) DeleteNamespace(w http.ResponseWriter, req *http.Request) + func (a *API) DeleteRuleGroup(w http.ResponseWriter, req *http.Request) + func (a *API) GetRuleGroup(w http.ResponseWriter, req *http.Request) + func (a *API) ListRules(w http.ResponseWriter, req *http.Request) + func (a *API) PrometheusAlerts(w http.ResponseWriter, req *http.Request) + func (a *API) PrometheusRules(w http.ResponseWriter, req *http.Request) + type Alert struct + ActiveAt *time.Time + Annotations labels.Labels + Labels labels.Labels + State string + Value string + type AlertDiscovery struct + Alerts []*Alert + type AlertStateDesc struct + ActiveAt time.Time + Annotations []github_com_frelon_loki_pkg_logproto.LabelAdapter + FiredAt time.Time + Labels []github_com_frelon_loki_pkg_logproto.LabelAdapter + LastSentAt time.Time + ResolvedAt time.Time + State string + ValidUntil time.Time + Value float64 + func (*AlertStateDesc) Descriptor() ([]byte, []int) + func (*AlertStateDesc) ProtoMessage() + func (m *AlertStateDesc) GetActiveAt() time.Time + func (m *AlertStateDesc) GetFiredAt() time.Time + func (m *AlertStateDesc) GetLastSentAt() time.Time + func (m *AlertStateDesc) GetResolvedAt() time.Time + func (m *AlertStateDesc) GetState() string + func (m *AlertStateDesc) GetValidUntil() time.Time + func (m *AlertStateDesc) GetValue() float64 + func (m *AlertStateDesc) Marshal() (dAtA []byte, err error) + func (m *AlertStateDesc) MarshalTo(dAtA []byte) (int, error) + func (m *AlertStateDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) + func (m *AlertStateDesc) Reset() + func (m *AlertStateDesc) Size() (n int) + func (m *AlertStateDesc) Unmarshal(dAtA []byte) error + func (m *AlertStateDesc) XXX_DiscardUnknown() + func (m *AlertStateDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *AlertStateDesc) XXX_Merge(src proto.Message) + func (m *AlertStateDesc) XXX_Size() int + func (m *AlertStateDesc) XXX_Unmarshal(b []byte) error + func (this *AlertStateDesc) Equal(that interface{}) bool + func (this *AlertStateDesc) GoString() string + func (this *AlertStateDesc) String() string + type ClientsPool interface + GetClientFor func(addr string) (RulerClient, error) + type Config struct + AlertmanagerDiscovery bool + AlertmanagerRefreshInterval time.Duration + AlertmanagerURL string + AlertmanangerEnableV2API bool + ClientTLSConfig grpcclient.Config + DisableRuleGroupLabel bool + DisabledTenants flagext.StringSliceCSV + EnableAPI bool + EnableQueryStats bool + EnableSharding bool + EnabledTenants flagext.StringSliceCSV + EvaluationInterval time.Duration + ExternalURL flagext.URLValue + FlushCheckPeriod time.Duration + ForGracePeriod time.Duration + NotificationQueueCapacity int + NotificationTimeout time.Duration + Notifier NotifierConfig + OutageTolerance time.Duration + PollInterval time.Duration + ResendDelay time.Duration + Ring RingConfig + RingCheckPeriod time.Duration + RulePath string + SearchPendingFor time.Duration + ShardingStrategy string + StoreConfig RuleStoreConfig + func (cfg *Config) RegisterFlags(f *flag.FlagSet) + func (cfg *Config) Validate(limits validation.Limits, log log.Logger) error + type DefaultMultiTenantManager struct + func NewDefaultMultiTenantManager(cfg Config, managerFactory ManagerFactory, reg prometheus.Registerer, ...) (*DefaultMultiTenantManager, error) + func (*DefaultMultiTenantManager) ValidateRuleGroup(g rulefmt.RuleGroup) []error + func (r *DefaultMultiTenantManager) GetRules(userID string) []*promRules.Group + func (r *DefaultMultiTenantManager) Stop() + func (r *DefaultMultiTenantManager) SyncRuleGroups(ctx context.Context, ruleGroups map[string]rulespb.RuleGroupList) + type GroupStateDesc struct + ActiveRules []*RuleStateDesc + EvaluationDuration time.Duration + EvaluationTimestamp time.Time + Group *rulespb.RuleGroupDesc + func (*GroupStateDesc) Descriptor() ([]byte, []int) + func (*GroupStateDesc) ProtoMessage() + func (m *GroupStateDesc) GetActiveRules() []*RuleStateDesc + func (m *GroupStateDesc) GetEvaluationDuration() time.Duration + func (m *GroupStateDesc) GetEvaluationTimestamp() time.Time + func (m *GroupStateDesc) GetGroup() *rulespb.RuleGroupDesc + func (m *GroupStateDesc) Marshal() (dAtA []byte, err error) + func (m *GroupStateDesc) MarshalTo(dAtA []byte) (int, error) + func (m *GroupStateDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) + func (m *GroupStateDesc) Reset() + func (m *GroupStateDesc) Size() (n int) + func (m *GroupStateDesc) Unmarshal(dAtA []byte) error + func (m *GroupStateDesc) XXX_DiscardUnknown() + func (m *GroupStateDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *GroupStateDesc) XXX_Merge(src proto.Message) + func (m *GroupStateDesc) XXX_Size() int + func (m *GroupStateDesc) XXX_Unmarshal(b []byte) error + func (this *GroupStateDesc) Equal(that interface{}) bool + func (this *GroupStateDesc) GoString() string + func (this *GroupStateDesc) String() string + type ManagerFactory func(ctx context.Context, userID string, notifier *notifier.Manager, ...) RulesManager + func DefaultTenantManagerFactory(cfg Config, p Pusher, q storage.Queryable, engine *promql.Engine, ...) ManagerFactory + type ManagerMetrics struct + EvalDuration *prometheus.Desc + EvalFailures *prometheus.Desc + EvalTotal *prometheus.Desc + GroupInterval *prometheus.Desc + GroupLastDuration *prometheus.Desc + GroupLastEvalSamples *prometheus.Desc + GroupLastEvalTime *prometheus.Desc + GroupRules *prometheus.Desc + IterationDuration *prometheus.Desc + IterationsMissed *prometheus.Desc + IterationsScheduled *prometheus.Desc + func NewManagerMetrics(disableRuleGroupLabel bool) *ManagerMetrics + func (m *ManagerMetrics) AddUserRegistry(user string, reg *prometheus.Registry) + func (m *ManagerMetrics) Collect(out chan<- prometheus.Metric) + func (m *ManagerMetrics) Describe(out chan<- *prometheus.Desc) + func (m *ManagerMetrics) RemoveUserRegistry(user string) + type MultiTenantManager interface + GetRules func(userID string) []*promRules.Group + Stop func() + SyncRuleGroups func(ctx context.Context, ruleGroups map[string]rulespb.RuleGroupList) + ValidateRuleGroup func(rulefmt.RuleGroup) []error + type NotifierConfig struct + BasicAuth util.BasicAuth + TLS tls.ClientConfig + func (cfg *NotifierConfig) RegisterFlags(f *flag.FlagSet) + type Pusher interface + Push func(context.Context, *logproto.WriteRequest) (*logproto.WriteResponse, error) + type PusherAppendable struct + func NewPusherAppendable(pusher Pusher, userID string, limits RulesLimits, ...) *PusherAppendable + func (t *PusherAppendable) Appender(ctx context.Context) storage.Appender + type PusherAppender struct + func (a *PusherAppender) Append(_ storage.SeriesRef, l labels.Labels, t int64, v float64) (storage.SeriesRef, error) + func (a *PusherAppender) AppendExemplar(_ storage.SeriesRef, _ labels.Labels, _ exemplar.Exemplar) (storage.SeriesRef, error) + func (a *PusherAppender) Commit() error + func (a *PusherAppender) Rollback() error + type QueryableError struct + func (q QueryableError) Error() string + func (q QueryableError) Unwrap() error + type RingConfig struct + HeartbeatPeriod time.Duration + HeartbeatTimeout time.Duration + InstanceAddr string + InstanceID string + InstanceInterfaceNames []string + InstancePort int + KVStore kv.Config + ListenPort int + NumTokens int + SkipUnregister bool + func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet) + func (cfg *RingConfig) ToLifecyclerConfig(logger log.Logger) (ring.BasicLifecyclerConfig, error) + func (cfg *RingConfig) ToRingConfig() ring.Config + type RuleDiscovery struct + RuleGroups []*RuleGroup + type RuleGroup struct + EvaluationTime float64 + File string + Interval float64 + LastEvaluation time.Time + Name string + Rules []rule + type RuleStateDesc struct + Alerts []*AlertStateDesc + EvaluationDuration time.Duration + EvaluationTimestamp time.Time + Health string + LastError string + Rule *rulespb.RuleDesc + State string + func (*RuleStateDesc) Descriptor() ([]byte, []int) + func (*RuleStateDesc) ProtoMessage() + func (m *RuleStateDesc) GetAlerts() []*AlertStateDesc + func (m *RuleStateDesc) GetEvaluationDuration() time.Duration + func (m *RuleStateDesc) GetEvaluationTimestamp() time.Time + func (m *RuleStateDesc) GetHealth() string + func (m *RuleStateDesc) GetLastError() string + func (m *RuleStateDesc) GetRule() *rulespb.RuleDesc + func (m *RuleStateDesc) GetState() string + func (m *RuleStateDesc) Marshal() (dAtA []byte, err error) + func (m *RuleStateDesc) MarshalTo(dAtA []byte) (int, error) + func (m *RuleStateDesc) MarshalToSizedBuffer(dAtA []byte) (int, error) + func (m *RuleStateDesc) Reset() + func (m *RuleStateDesc) Size() (n int) + func (m *RuleStateDesc) Unmarshal(dAtA []byte) error + func (m *RuleStateDesc) XXX_DiscardUnknown() + func (m *RuleStateDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *RuleStateDesc) XXX_Merge(src proto.Message) + func (m *RuleStateDesc) XXX_Size() int + func (m *RuleStateDesc) XXX_Unmarshal(b []byte) error + func (this *RuleStateDesc) Equal(that interface{}) bool + func (this *RuleStateDesc) GoString() string + func (this *RuleStateDesc) String() string + type RuleStoreConfig struct + Azure azure.BlobStorageConfig + ConfigDB configClient.Config + GCS gcp.GCSConfig + Local local.Config + S3 aws.S3Config + Swift openstack.SwiftConfig + Type string + func (cfg *RuleStoreConfig) IsDefaults() bool + func (cfg *RuleStoreConfig) RegisterFlags(f *flag.FlagSet) + func (cfg *RuleStoreConfig) Validate() error + type Ruler struct + func NewRuler(cfg Config, manager MultiTenantManager, reg prometheus.Registerer, ...) (*Ruler, error) + func (r *Ruler) AssertMaxRuleGroups(userID string, rg int) error + func (r *Ruler) AssertMaxRulesPerRuleGroup(userID string, rules int) error + func (r *Ruler) DeleteTenantConfiguration(w http.ResponseWriter, req *http.Request) + func (r *Ruler) GetRules(ctx context.Context) ([]*GroupStateDesc, error) + func (r *Ruler) ListAllRules(w http.ResponseWriter, req *http.Request) + func (r *Ruler) OnRingInstanceHeartbeat(_ *ring.BasicLifecycler, _ *ring.Desc, _ *ring.InstanceDesc) + func (r *Ruler) OnRingInstanceRegister(_ *ring.BasicLifecycler, ringDesc ring.Desc, instanceExists bool, ...) (ring.InstanceState, ring.Tokens) + func (r *Ruler) OnRingInstanceStopping(_ *ring.BasicLifecycler) + func (r *Ruler) OnRingInstanceTokens(_ *ring.BasicLifecycler, _ ring.Tokens) + func (r *Ruler) Rules(ctx context.Context, in *RulesRequest) (*RulesResponse, error) + func (r *Ruler) ServeHTTP(w http.ResponseWriter, req *http.Request) + type RulerClient interface + Rules func(ctx context.Context, in *RulesRequest, opts ...grpc.CallOption) (*RulesResponse, error) + func NewRulerClient(cc *grpc.ClientConn) RulerClient + type RulerServer interface + Rules func(context.Context, *RulesRequest) (*RulesResponse, error) + type RulesLimits interface + EvaluationDelay func(userID string) time.Duration + RulerMaxRuleGroupsPerTenant func(userID string) int + RulerMaxRulesPerRuleGroup func(userID string) int + RulerTenantShardSize func(userID string) int + type RulesManager interface + RuleGroups func() []*rules.Group + Run func() + Stop func() + Update func(interval time.Duration, files []string, externalLabels labels.Labels, ...) error + type RulesRequest struct + func (*RulesRequest) Descriptor() ([]byte, []int) + func (*RulesRequest) ProtoMessage() + func (m *RulesRequest) Marshal() (dAtA []byte, err error) + func (m *RulesRequest) MarshalTo(dAtA []byte) (int, error) + func (m *RulesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) + func (m *RulesRequest) Reset() + func (m *RulesRequest) Size() (n int) + func (m *RulesRequest) Unmarshal(dAtA []byte) error + func (m *RulesRequest) XXX_DiscardUnknown() + func (m *RulesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *RulesRequest) XXX_Merge(src proto.Message) + func (m *RulesRequest) XXX_Size() int + func (m *RulesRequest) XXX_Unmarshal(b []byte) error + func (this *RulesRequest) Equal(that interface{}) bool + func (this *RulesRequest) GoString() string + func (this *RulesRequest) String() string + type RulesResponse struct + Groups []*GroupStateDesc + func (*RulesResponse) Descriptor() ([]byte, []int) + func (*RulesResponse) ProtoMessage() + func (m *RulesResponse) GetGroups() []*GroupStateDesc + func (m *RulesResponse) Marshal() (dAtA []byte, err error) + func (m *RulesResponse) MarshalTo(dAtA []byte) (int, error) + func (m *RulesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) + func (m *RulesResponse) Reset() + func (m *RulesResponse) Size() (n int) + func (m *RulesResponse) Unmarshal(dAtA []byte) error + func (m *RulesResponse) XXX_DiscardUnknown() + func (m *RulesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *RulesResponse) XXX_Merge(src proto.Message) + func (m *RulesResponse) XXX_Size() int + func (m *RulesResponse) XXX_Unmarshal(b []byte) error + func (this *RulesResponse) Equal(that interface{}) bool + func (this *RulesResponse) GoString() string + func (this *RulesResponse) String() string + type UnimplementedRulerServer struct + func (*UnimplementedRulerServer) Rules(ctx context.Context, req *RulesRequest) (*RulesResponse, error)