Documentation ¶
Index ¶
- Constants
- Variables
- func AllowProtectionOverride(reqHeaders http.Header, namespace string) error
- func DialQueryFrontend(cfg QueryFrontendConfig) (httpgrpc.HTTPClient, error)
- func ExtractTenantIDs(ctx context.Context) (string, error)
- func FederatedGroupContextFunc(ctx context.Context, g *rules.Group) context.Context
- func MetricsQueryFunc(qf rules.QueryFunc, queries, failedQueries prometheus.Counter, ...) rules.QueryFunc
- func NewRuleStore(ctx context.Context, cfg rulestore.Config, ...) (store rulestore.RuleStore, _ error)
- func ProtectedNamespacesHeaderFromSet(namespacesSet map[string]struct{}) http.Header
- func ProtectedNamespacesHeaderFromString(namespace string) http.Header
- func RecordAndReportRuleQueryMetrics(qf rules.QueryFunc, queryTime, zeroFetchedSeriesCount prometheus.Counter, ...) rules.QueryFunc
- func RegisterRulerServer(s *grpc.Server, srv RulerServer)
- func TenantFederationQueryFunc(regularQueryable, federatedQueryable rules.QueryFunc) rules.QueryFunc
- func WithOrgIDMiddleware(ctx context.Context, req *httpgrpc.HTTPRequest) error
- func WrapQueryFuncWithReadConsistency(fn rules.QueryFunc, logger log.Logger) rules.QueryFunc
- func WrapQueryableErrors(err error) error
- func WrapQueryableWithReadConsistency(q storage.Queryable, logger log.Logger) storage.Queryable
- type 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
- type AlertDiscovery
- type AlertStateDesc
- func (*AlertStateDesc) Descriptor() ([]byte, []int)
- func (this *AlertStateDesc) Equal(that interface{}) bool
- func (m *AlertStateDesc) GetActiveAt() time.Time
- func (m *AlertStateDesc) GetFiredAt() time.Time
- func (m *AlertStateDesc) GetKeepFiringSince() 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 (this *AlertStateDesc) GoString() string
- 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 (*AlertStateDesc) ProtoMessage()
- func (m *AlertStateDesc) Reset()
- func (m *AlertStateDesc) Size() (n int)
- func (this *AlertStateDesc) String() string
- 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
- type ClientsPool
- type Config
- type DefaultMultiTenantManager
- func (r *DefaultMultiTenantManager) GetRules(userID string) []*promRules.Group
- func (r *DefaultMultiTenantManager) Start()
- func (r *DefaultMultiTenantManager) Stop()
- func (r *DefaultMultiTenantManager) SyncFullRuleGroups(ctx context.Context, ruleGroupsByUser map[string]rulespb.RuleGroupList)
- func (r *DefaultMultiTenantManager) SyncPartialRuleGroups(ctx context.Context, ruleGroupsByUser map[string]rulespb.RuleGroupList)
- func (r *DefaultMultiTenantManager) ValidateRuleGroup(g rulefmt.RuleGroup) []error
- type DynamicSemaphore
- type GroupStateDesc
- func (*GroupStateDesc) Descriptor() ([]byte, []int)
- func (this *GroupStateDesc) Equal(that interface{}) bool
- func (m *GroupStateDesc) GetActiveRules() []*RuleStateDesc
- func (m *GroupStateDesc) GetEvaluationDuration() time.Duration
- func (m *GroupStateDesc) GetEvaluationTimestamp() time.Time
- func (m *GroupStateDesc) GetGroup() *rulespb.RuleGroupDesc
- func (this *GroupStateDesc) GoString() string
- 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 (*GroupStateDesc) ProtoMessage()
- func (m *GroupStateDesc) Reset()
- func (m *GroupStateDesc) Size() (n int)
- func (this *GroupStateDesc) String() string
- 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
- type ManagerFactory
- type ManagerMetrics
- type Middleware
- type MultiTenantConcurrencyController
- type MultiTenantConcurrencyControllerMetrics
- type MultiTenantManager
- type MultiTenantRuleConcurrencyController
- type NoopAppendable
- type NoopAppender
- func (a *NoopAppender) Append(_ storage.SeriesRef, _ labels.Labels, _ int64, _ float64) (storage.SeriesRef, error)
- func (a *NoopAppender) AppendCTZeroSample(_ storage.SeriesRef, _ labels.Labels, _, _ int64) (storage.SeriesRef, error)
- func (a *NoopAppender) AppendExemplar(_ storage.SeriesRef, _ labels.Labels, _ exemplar.Exemplar) (storage.SeriesRef, error)
- func (a *NoopAppender) AppendHistogram(_ storage.SeriesRef, _ labels.Labels, _ int64, _ *histogram.Histogram, ...) (storage.SeriesRef, error)
- func (a *NoopAppender) AppendHistogramCTZeroSample(storage.SeriesRef, labels.Labels, int64, int64, *histogram.Histogram, ...) (storage.SeriesRef, error)
- func (a *NoopAppender) Commit() error
- func (a *NoopAppender) Rollback() error
- func (a *NoopAppender) SetOptions(*storage.AppendOptions)
- func (a *NoopAppender) UpdateMetadata(_ storage.SeriesRef, _ labels.Labels, _ metadata.Metadata) (storage.SeriesRef, error)
- type NoopMultiTenantConcurrencyController
- type NoopTenantConcurrencyController
- type NotifierConfig
- type OAuth2Config
- type Pusher
- type PusherAppendable
- type PusherAppender
- func (a *PusherAppender) Append(_ storage.SeriesRef, l labels.Labels, t int64, v float64) (storage.SeriesRef, error)
- func (a *PusherAppender) AppendCTZeroSample(_ storage.SeriesRef, _ labels.Labels, _, _ int64) (storage.SeriesRef, error)
- func (a *PusherAppender) AppendExemplar(_ storage.SeriesRef, _ labels.Labels, _ exemplar.Exemplar) (storage.SeriesRef, error)
- func (a *PusherAppender) AppendHistogram(_ storage.SeriesRef, l labels.Labels, t int64, h *histogram.Histogram, ...) (storage.SeriesRef, error)
- func (a *PusherAppender) AppendHistogramCTZeroSample(storage.SeriesRef, labels.Labels, int64, int64, *histogram.Histogram, ...) (storage.SeriesRef, error)
- func (a *PusherAppender) Commit() error
- func (a *PusherAppender) Rollback() error
- func (a *PusherAppender) SetOptions(*storage.AppendOptions)
- func (a *PusherAppender) UpdateMetadata(_ storage.SeriesRef, _ labels.Labels, _ metadata.Metadata) (storage.SeriesRef, error)
- type QueryFrontendConfig
- type QueryableError
- type RemoteQuerier
- type RingConfig
- type RuleDiscovery
- type RuleGroup
- type RuleStateDesc
- func (*RuleStateDesc) Descriptor() ([]byte, []int)
- func (this *RuleStateDesc) Equal(that interface{}) bool
- 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 (this *RuleStateDesc) GoString() 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 (*RuleStateDesc) ProtoMessage()
- func (m *RuleStateDesc) Reset()
- func (m *RuleStateDesc) Size() (n int)
- func (this *RuleStateDesc) String() string
- 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
- type Ruler
- func (r *Ruler) AssertMaxRuleGroups(userID, namespace string, rg int) error
- func (r *Ruler) AssertMaxRulesPerRuleGroup(userID, namespace string, rules int) error
- func (r *Ruler) DeleteTenantConfiguration(w http.ResponseWriter, req *http.Request)
- func (r *Ruler) GetRules(ctx context.Context, req RulesRequest) ([]*GroupStateDesc, string, error)
- func (r *Ruler) IsMaxRuleGroupsLimited(userID, namespace string) bool
- func (r *Ruler) IsNamespaceProtected(userID string, namespace string) bool
- func (r *Ruler) ListAllRules(w http.ResponseWriter, req *http.Request)
- func (r *Ruler) NotifySyncRulesAsync(userID string)
- func (r *Ruler) Rules(ctx context.Context, in *RulesRequest) (*RulesResponse, error)
- func (r *Ruler) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Ruler) SyncRules(_ context.Context, req *SyncRulesRequest) (*SyncRulesResponse, error)
- type RulerClient
- type RulerServer
- type RulesLimits
- type RulesManager
- type RulesRequest
- func (*RulesRequest) Descriptor() ([]byte, []int)
- func (this *RulesRequest) Equal(that interface{}) bool
- func (m *RulesRequest) GetExcludeAlerts() bool
- func (m *RulesRequest) GetFile() []string
- func (m *RulesRequest) GetFilter() RulesRequest_RuleType
- func (m *RulesRequest) GetMaxGroups() int32
- func (m *RulesRequest) GetNextToken() string
- func (m *RulesRequest) GetRuleGroup() []string
- func (m *RulesRequest) GetRuleName() []string
- func (this *RulesRequest) GoString() string
- 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 (*RulesRequest) ProtoMessage()
- func (m *RulesRequest) Reset()
- func (m *RulesRequest) Size() (n int)
- func (this *RulesRequest) String() string
- 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
- type RulesRequest_RuleType
- type RulesResponse
- func (*RulesResponse) Descriptor() ([]byte, []int)
- func (this *RulesResponse) Equal(that interface{}) bool
- func (m *RulesResponse) GetGroups() []*GroupStateDesc
- func (this *RulesResponse) GoString() string
- 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 (*RulesResponse) ProtoMessage()
- func (m *RulesResponse) Reset()
- func (m *RulesResponse) Size() (n int)
- func (this *RulesResponse) String() string
- 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
- type StringFilterSet
- type SyncRulesRequest
- func (*SyncRulesRequest) Descriptor() ([]byte, []int)
- func (this *SyncRulesRequest) Equal(that interface{}) bool
- func (m *SyncRulesRequest) GetUserIds() []string
- func (this *SyncRulesRequest) GoString() string
- func (m *SyncRulesRequest) Marshal() (dAtA []byte, err error)
- func (m *SyncRulesRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *SyncRulesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*SyncRulesRequest) ProtoMessage()
- func (m *SyncRulesRequest) Reset()
- func (m *SyncRulesRequest) Size() (n int)
- func (this *SyncRulesRequest) String() string
- func (m *SyncRulesRequest) Unmarshal(dAtA []byte) error
- func (m *SyncRulesRequest) XXX_DiscardUnknown()
- func (m *SyncRulesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SyncRulesRequest) XXX_Merge(src proto.Message)
- func (m *SyncRulesRequest) XXX_Size() int
- func (m *SyncRulesRequest) XXX_Unmarshal(b []byte) error
- type SyncRulesResponse
- func (*SyncRulesResponse) Descriptor() ([]byte, []int)
- func (this *SyncRulesResponse) Equal(that interface{}) bool
- func (this *SyncRulesResponse) GoString() string
- func (m *SyncRulesResponse) Marshal() (dAtA []byte, err error)
- func (m *SyncRulesResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *SyncRulesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*SyncRulesResponse) ProtoMessage()
- func (m *SyncRulesResponse) Reset()
- func (m *SyncRulesResponse) Size() (n int)
- func (this *SyncRulesResponse) String() string
- func (m *SyncRulesResponse) Unmarshal(dAtA []byte) error
- func (m *SyncRulesResponse) XXX_DiscardUnknown()
- func (m *SyncRulesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SyncRulesResponse) XXX_Merge(src proto.Message)
- func (m *SyncRulesResponse) XXX_Size() int
- func (m *SyncRulesResponse) XXX_Unmarshal(b []byte) error
- type TenantConcurrencyController
- type TenantFederationConfig
- type UnimplementedRulerServer
Constants ¶
const ( OverrideProtectionHeader = "X-Mimir-Ruler-Override-Namespace-Protection" ProtectedNamespacesHeader = "X-Mimir-Ruler-Protected-Namespaces" )
const (
// RulerRingKey is the key under which we store the rulers ring in the KVStore.
RulerRingKey = "ring"
)
const TenantFederationFlag = "ruler.tenant-federation.enabled"
Variables ¶
var ( // ErrNoNamespace signals that no namespace was specified in the request ErrNoNamespace = errors.New("a namespace must be provided in the request") // ErrNoGroupName signals a group name url parameter was not found ErrNoGroupName = errors.New("a matching group name must be provided in the request") // ErrNoRuleGroups signals the rule group requested does not exist ErrNoRuleGroups = errors.New("no rule groups found") // ErrBadRuleGroup is returned when the provided rule group can not be unmarshalled ErrBadRuleGroup = errors.New("unable to decode rule group") )
var ( ErrNoProtectionOverrideHeader = errors.New("no protection override header") ErrNamespaceTargetNotMatch = errors.New("namespace does not match target") )
var ( ErrInvalidLengthRuler = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowRuler = fmt.Errorf("proto: integer overflow") )
var ( // RuleEvalRingOp is the operation used for distributing rule groups between rulers. RuleEvalRingOp = ring.NewOp([]ring.InstanceState{ring.ACTIVE}, func(s ring.InstanceState) bool { return s != ring.ACTIVE }) RuleSyncRingOp = ring.NewOp([]ring.InstanceState{ring.JOINING, ring.ACTIVE}, func(s ring.InstanceState) bool { return s != ring.ACTIVE && s != ring.JOINING }) )
var RulesRequest_RuleType_name = map[int32]string{
0: "AnyRule",
1: "AlertingRule",
2: "RecordingRule",
}
var RulesRequest_RuleType_value = map[string]int32{
"AnyRule": 0,
"AlertingRule": 1,
"RecordingRule": 2,
}
Functions ¶
func AllowProtectionOverride ¶
AllowProtectionOverride checks if the request headers contain the protection override header and if the given namespace is in the list of overrides.
func DialQueryFrontend ¶
func DialQueryFrontend(cfg QueryFrontendConfig) (httpgrpc.HTTPClient, error)
DialQueryFrontend creates and initializes a new httpgrpc.HTTPClient taking a QueryFrontendConfig configuration.
func ExtractTenantIDs ¶
ExtractTenantIDs gets the rule group org ID from the context.
func FederatedGroupContextFunc ¶
FederatedGroupContextFunc prepares the context for federated rules. It injects g.SourceTenants() in to the context to be used by mergeQuerier.
func MetricsQueryFunc ¶
func NewRuleStore ¶
func NewRuleStore(ctx context.Context, cfg rulestore.Config, cfgProvider bucket.TenantConfigProvider, loader promRules.GroupLoader, cacheTTL time.Duration, logger log.Logger, reg prometheus.Registerer) (store rulestore.RuleStore, _ error)
NewRuleStore returns a rule store backend client based on the provided cfg.
func ProtectedNamespacesHeaderFromSet ¶
ProtectedNamespacesHeaderFromSet returns a http.Header with the given namespaces command-separated as the value and ProtectedNamespacesHeader as the key.
func ProtectedNamespacesHeaderFromString ¶
ProtectedNamespacesHeaderFromString returns a http.Header with the given namespace as the value and ProtectedNamespacesHeader as the key.
func RegisterRulerServer ¶
func RegisterRulerServer(s *grpc.Server, srv RulerServer)
func WithOrgIDMiddleware ¶
func WithOrgIDMiddleware(ctx context.Context, req *httpgrpc.HTTPRequest) error
WithOrgIDMiddleware attaches 'X-Scope-OrgID' header value to the outgoing request by inspecting the passed context. In case the expression to evaluate corresponds to a federated rule, the ExtractTenantIDs function will take care of normalizing and concatenating source tenants by separating them with a '|' character.
func WrapQueryFuncWithReadConsistency ¶
WrapQueryFuncWithReadConsistency wraps rules.QueryFunc with a function that injects strong read consistency requirement in the context if the query is originated from a rule which depends on other rules in the same rule group.
func WrapQueryableErrors ¶
func WrapQueryableWithReadConsistency ¶
WrapQueryableWithReadConsistency wraps storage.Queryable with a queryable that injects strong read consistency requirement in the context for any request matching ALERTS_FOR_STATE metric name.
The ALERTS_FOR_STATE metric is used to restore the state of a firing alert each time a rule Group is started. In case of Mimir, it could happen for example when the ruler starts, or rule groups are resharded among rulers.
When querying the ALERTS_FOR_STATE, ruler requires strong consistency in order to ensure we restore the state from the last evaluation. Without such guarantee, the ruler may query a previous state.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is used to handle HTTP requests for the ruler service
func (*API) CreateRuleGroup ¶
func (a *API) CreateRuleGroup(w http.ResponseWriter, req *http.Request)
func (*API) DeleteNamespace ¶
func (a *API) DeleteNamespace(w http.ResponseWriter, req *http.Request)
func (*API) DeleteRuleGroup ¶
func (a *API) DeleteRuleGroup(w http.ResponseWriter, req *http.Request)
func (*API) GetRuleGroup ¶
func (a *API) GetRuleGroup(w http.ResponseWriter, req *http.Request)
func (*API) PrometheusAlerts ¶
func (a *API) PrometheusAlerts(w http.ResponseWriter, req *http.Request)
func (*API) PrometheusRules ¶
func (a *API) PrometheusRules(w http.ResponseWriter, req *http.Request)
type Alert ¶
type Alert struct { Labels labels.Labels `json:"labels"` Annotations labels.Labels `json:"annotations"` State string `json:"state"` ActiveAt *time.Time `json:"activeAt,omitempty"` KeepFiringSince *time.Time `json:"keepFiringSince,omitempty"` Value string `json:"value"` }
Alert has info for an alert.
type AlertDiscovery ¶
type AlertDiscovery struct {
Alerts []*Alert `json:"alerts"`
}
AlertDiscovery has info for all active alerts.
type AlertStateDesc ¶
type AlertStateDesc struct { State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` Labels []github_com_grafana_mimir_pkg_mimirpb.LabelAdapter `protobuf:"bytes,2,rep,name=labels,proto3,customtype=github.com/grafana/mimir/pkg/mimirpb.LabelAdapter" json:"labels"` Annotations []github_com_grafana_mimir_pkg_mimirpb.LabelAdapter `` /* 126-byte string literal not displayed */ Value float64 `protobuf:"fixed64,4,opt,name=value,proto3" json:"value,omitempty"` ActiveAt time.Time `protobuf:"bytes,5,opt,name=active_at,json=activeAt,proto3,stdtime" json:"active_at"` FiredAt time.Time `protobuf:"bytes,6,opt,name=fired_at,json=firedAt,proto3,stdtime" json:"fired_at"` ResolvedAt time.Time `protobuf:"bytes,7,opt,name=resolved_at,json=resolvedAt,proto3,stdtime" json:"resolved_at"` LastSentAt time.Time `protobuf:"bytes,8,opt,name=last_sent_at,json=lastSentAt,proto3,stdtime" json:"last_sent_at"` ValidUntil time.Time `protobuf:"bytes,9,opt,name=valid_until,json=validUntil,proto3,stdtime" json:"valid_until"` KeepFiringSince time.Time `protobuf:"bytes,10,opt,name=keep_firing_since,json=keepFiringSince,proto3,stdtime" json:"keep_firing_since"` }
func (*AlertStateDesc) Descriptor ¶
func (*AlertStateDesc) Descriptor() ([]byte, []int)
func (*AlertStateDesc) Equal ¶
func (this *AlertStateDesc) Equal(that interface{}) bool
func (*AlertStateDesc) GetActiveAt ¶
func (m *AlertStateDesc) GetActiveAt() time.Time
func (*AlertStateDesc) GetFiredAt ¶
func (m *AlertStateDesc) GetFiredAt() time.Time
func (*AlertStateDesc) GetKeepFiringSince ¶
func (m *AlertStateDesc) GetKeepFiringSince() time.Time
func (*AlertStateDesc) GetLastSentAt ¶
func (m *AlertStateDesc) GetLastSentAt() time.Time
func (*AlertStateDesc) GetResolvedAt ¶
func (m *AlertStateDesc) GetResolvedAt() time.Time
func (*AlertStateDesc) GetState ¶
func (m *AlertStateDesc) GetState() string
func (*AlertStateDesc) GetValidUntil ¶
func (m *AlertStateDesc) GetValidUntil() time.Time
func (*AlertStateDesc) GetValue ¶
func (m *AlertStateDesc) GetValue() float64
func (*AlertStateDesc) GoString ¶
func (this *AlertStateDesc) GoString() string
func (*AlertStateDesc) Marshal ¶
func (m *AlertStateDesc) Marshal() (dAtA []byte, err error)
func (*AlertStateDesc) MarshalToSizedBuffer ¶
func (m *AlertStateDesc) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*AlertStateDesc) ProtoMessage ¶
func (*AlertStateDesc) ProtoMessage()
func (*AlertStateDesc) Reset ¶
func (m *AlertStateDesc) Reset()
func (*AlertStateDesc) Size ¶
func (m *AlertStateDesc) Size() (n int)
func (*AlertStateDesc) String ¶
func (this *AlertStateDesc) String() string
func (*AlertStateDesc) Unmarshal ¶
func (m *AlertStateDesc) Unmarshal(dAtA []byte) error
func (*AlertStateDesc) XXX_DiscardUnknown ¶
func (m *AlertStateDesc) XXX_DiscardUnknown()
func (*AlertStateDesc) XXX_Marshal ¶
func (m *AlertStateDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AlertStateDesc) XXX_Merge ¶
func (m *AlertStateDesc) XXX_Merge(src proto.Message)
func (*AlertStateDesc) XXX_Size ¶
func (m *AlertStateDesc) XXX_Size() int
func (*AlertStateDesc) XXX_Unmarshal ¶
func (m *AlertStateDesc) XXX_Unmarshal(b []byte) error
type ClientsPool ¶
type ClientsPool interface { services.Service // GetClientForInstance returns the ruler client for the ring instance. GetClientForInstance(inst ring.InstanceDesc) (RulerClient, error) }
ClientsPool is the interface used to get the client from the pool for a specified address.
type Config ¶
type Config struct { // This is used for template expansion in alerts; must be a valid URL. ExternalURL flagext.URLValue `yaml:"external_url"` // GRPC Client configuration. ClientTLSConfig grpcclient.Config `yaml:"ruler_client" doc:"description=Configures the gRPC client used to communicate between ruler instances."` // How frequently to evaluate rules by default. EvaluationInterval time.Duration `yaml:"evaluation_interval" category:"advanced"` // How frequently to poll for updated rules. PollInterval time.Duration `yaml:"poll_interval" category:"advanced"` // Path to store rule files for prom manager. RulePath string `yaml:"rule_path"` // URL of the Alertmanager to send notifications to. AlertmanagerURL string `yaml:"alertmanager_url"` // How long to wait between refreshing the list of Alertmanager based on DNS service discovery. AlertmanagerRefreshInterval time.Duration `yaml:"alertmanager_refresh_interval" category:"advanced"` // Capacity of the queue for notifications to be sent to the Alertmanager. NotificationQueueCapacity int `yaml:"notification_queue_capacity" category:"advanced"` // HTTP timeout duration when sending notifications to the Alertmanager. NotificationTimeout time.Duration `yaml:"notification_timeout" category:"advanced"` // Client configs for interacting with the Alertmanager Notifier NotifierConfig `yaml:"alertmanager_client"` // Max time to tolerate outage for restoring "for" state of alert. OutageTolerance time.Duration `yaml:"for_outage_tolerance" category:"advanced"` // Minimum duration between alert and restored "for" state. This is maintained only for alerts with configured "for" time greater than grace period. ForGracePeriod time.Duration `yaml:"for_grace_period" category:"advanced"` // Minimum amount of time to wait before resending an alert to Alertmanager. ResendDelay time.Duration `yaml:"resend_delay" category:"advanced"` // Enable sharding rule groups. Ring RingConfig `yaml:"ring"` EnableAPI bool `yaml:"enable_api"` EnabledTenants flagext.StringSliceCSV `yaml:"enabled_tenants" category:"advanced"` DisabledTenants flagext.StringSliceCSV `yaml:"disabled_tenants" category:"advanced"` EnableQueryStats bool `yaml:"query_stats_enabled" category:"advanced"` QueryFrontend QueryFrontendConfig `yaml:"query_frontend"` TenantFederation TenantFederationConfig `yaml:"tenant_federation"` OutboundSyncQueuePollInterval time.Duration `yaml:"outbound_sync_queue_poll_interval" category:"experimental"` InboundSyncQueuePollInterval time.Duration `yaml:"inbound_sync_queue_poll_interval" category:"experimental"` // Allow to override timers for testing purposes. RingCheckPeriod time.Duration `yaml:"-"` MaxIndependentRuleEvaluationConcurrency int64 `yaml:"max_independent_rule_evaluation_concurrency" category:"experimental"` IndependentRuleEvaluationConcurrencyMinDurationPercentage float64 `yaml:"independent_rule_evaluation_concurrency_min_duration_percentage" category:"experimental"` RuleEvaluationWriteEnabled bool `yaml:"rule_evaluation_write_enabled" category:"experimental"` }
Config is the configuration for the recording rules server.
func (*Config) RegisterFlags ¶
RegisterFlags adds the flags required to config this to the given FlagSet
type DefaultMultiTenantManager ¶
type DefaultMultiTenantManager struct {
// contains filtered or unexported fields
}
func NewDefaultMultiTenantManager ¶
func NewDefaultMultiTenantManager(cfg Config, managerFactory ManagerFactory, reg prometheus.Registerer, logger log.Logger, dnsResolver cache.AddressProvider) (*DefaultMultiTenantManager, error)
func (*DefaultMultiTenantManager) GetRules ¶
func (r *DefaultMultiTenantManager) GetRules(userID string) []*promRules.Group
func (*DefaultMultiTenantManager) Start ¶
func (r *DefaultMultiTenantManager) Start()
func (*DefaultMultiTenantManager) Stop ¶
func (r *DefaultMultiTenantManager) Stop()
func (*DefaultMultiTenantManager) SyncFullRuleGroups ¶
func (r *DefaultMultiTenantManager) SyncFullRuleGroups(ctx context.Context, ruleGroupsByUser map[string]rulespb.RuleGroupList)
SyncFullRuleGroups implements MultiTenantManager. It's not safe to call this function concurrently with SyncFullRuleGroups() or SyncPartialRuleGroups().
func (*DefaultMultiTenantManager) SyncPartialRuleGroups ¶
func (r *DefaultMultiTenantManager) SyncPartialRuleGroups(ctx context.Context, ruleGroupsByUser map[string]rulespb.RuleGroupList)
SyncPartialRuleGroups implements MultiTenantManager. It's not safe to call this function concurrently with SyncFullRuleGroups() or SyncPartialRuleGroups().
func (*DefaultMultiTenantManager) ValidateRuleGroup ¶
func (r *DefaultMultiTenantManager) ValidateRuleGroup(g rulefmt.RuleGroup) []error
type DynamicSemaphore ¶
type DynamicSemaphore struct {
// contains filtered or unexported fields
}
DynamicSemaphore is a semaphore that can dynamically change its max concurrency. It is necessary as the max concurrency is defined by the tenant limits which can be changed at runtime.
func NewDynamicSemaphore ¶
func NewDynamicSemaphore(maxConcurrency func() int64) *DynamicSemaphore
NewDynamicSemaphore creates a new DynamicSemaphore
func (*DynamicSemaphore) Release ¶
func (ds *DynamicSemaphore) Release()
Release releases a token back to the semaphore.
func (*DynamicSemaphore) TryAcquire ¶
func (ds *DynamicSemaphore) TryAcquire() bool
TryAcquire tries to acquire a token from the semaphore.
type GroupStateDesc ¶
type GroupStateDesc struct { Group *rulespb.RuleGroupDesc `protobuf:"bytes,1,opt,name=group,proto3" json:"group,omitempty"` ActiveRules []*RuleStateDesc `protobuf:"bytes,2,rep,name=active_rules,json=activeRules,proto3" json:"active_rules,omitempty"` EvaluationTimestamp time.Time `protobuf:"bytes,3,opt,name=evaluationTimestamp,proto3,stdtime" json:"evaluationTimestamp"` EvaluationDuration time.Duration `protobuf:"bytes,4,opt,name=evaluationDuration,proto3,stdduration" json:"evaluationDuration"` }
GroupStateDesc is a proto representation of a mimir rule group
func (*GroupStateDesc) Descriptor ¶
func (*GroupStateDesc) Descriptor() ([]byte, []int)
func (*GroupStateDesc) Equal ¶
func (this *GroupStateDesc) Equal(that interface{}) bool
func (*GroupStateDesc) GetActiveRules ¶
func (m *GroupStateDesc) GetActiveRules() []*RuleStateDesc
func (*GroupStateDesc) GetEvaluationDuration ¶
func (m *GroupStateDesc) GetEvaluationDuration() time.Duration
func (*GroupStateDesc) GetEvaluationTimestamp ¶
func (m *GroupStateDesc) GetEvaluationTimestamp() time.Time
func (*GroupStateDesc) GetGroup ¶
func (m *GroupStateDesc) GetGroup() *rulespb.RuleGroupDesc
func (*GroupStateDesc) GoString ¶
func (this *GroupStateDesc) GoString() string
func (*GroupStateDesc) Marshal ¶
func (m *GroupStateDesc) Marshal() (dAtA []byte, err error)
func (*GroupStateDesc) MarshalToSizedBuffer ¶
func (m *GroupStateDesc) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GroupStateDesc) ProtoMessage ¶
func (*GroupStateDesc) ProtoMessage()
func (*GroupStateDesc) Reset ¶
func (m *GroupStateDesc) Reset()
func (*GroupStateDesc) Size ¶
func (m *GroupStateDesc) Size() (n int)
func (*GroupStateDesc) String ¶
func (this *GroupStateDesc) String() string
func (*GroupStateDesc) Unmarshal ¶
func (m *GroupStateDesc) Unmarshal(dAtA []byte) error
func (*GroupStateDesc) XXX_DiscardUnknown ¶
func (m *GroupStateDesc) XXX_DiscardUnknown()
func (*GroupStateDesc) XXX_Marshal ¶
func (m *GroupStateDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GroupStateDesc) XXX_Merge ¶
func (m *GroupStateDesc) XXX_Merge(src proto.Message)
func (*GroupStateDesc) XXX_Size ¶
func (m *GroupStateDesc) XXX_Size() int
func (*GroupStateDesc) XXX_Unmarshal ¶
func (m *GroupStateDesc) XXX_Unmarshal(b []byte) error
type ManagerFactory ¶
type ManagerFactory func(ctx context.Context, userID string, notifier *notifier.Manager, logger log.Logger, reg prometheus.Registerer) RulesManager
ManagerFactory is a function that creates new RulesManager for given user and notifier.Manager.
func DefaultTenantManagerFactory ¶
func DefaultTenantManagerFactory( cfg Config, pusher Pusher, queryable storage.Queryable, queryFunc rules.QueryFunc, concurrencyController MultiTenantRuleConcurrencyController, overrides RulesLimits, reg prometheus.Registerer, ) ManagerFactory
type ManagerMetrics ¶
type ManagerMetrics struct { EvalDuration *prometheus.Desc IterationDuration *prometheus.Desc IterationsMissed *prometheus.Desc IterationsScheduled *prometheus.Desc EvalTotal *prometheus.Desc EvalFailures *prometheus.Desc GroupInterval *prometheus.Desc GroupLastEvalTime *prometheus.Desc GroupLastDuration *prometheus.Desc GroupLastRestoreDuration *prometheus.Desc GroupRules *prometheus.Desc GroupLastEvalSamples *prometheus.Desc // contains filtered or unexported fields }
ManagerMetrics aggregates metrics exported by the Prometheus rules package and returns them as Mimir metrics
func NewManagerMetrics ¶
func NewManagerMetrics(logger log.Logger) *ManagerMetrics
NewManagerMetrics returns a ManagerMetrics struct
func (*ManagerMetrics) AddUserRegistry ¶
func (m *ManagerMetrics) AddUserRegistry(user string, reg *prometheus.Registry)
AddUserRegistry adds a user-specific Prometheus registry.
func (*ManagerMetrics) Collect ¶
func (m *ManagerMetrics) Collect(out chan<- prometheus.Metric)
Collect implements the Collector interface
func (*ManagerMetrics) Describe ¶
func (m *ManagerMetrics) Describe(out chan<- *prometheus.Desc)
Describe implements the Collector interface
func (*ManagerMetrics) RemoveUserRegistry ¶
func (m *ManagerMetrics) RemoveUserRegistry(user string)
RemoveUserRegistry removes user-specific Prometheus registry.
type Middleware ¶
type Middleware func(ctx context.Context, req *httpgrpc.HTTPRequest) error
Middleware provides a mechanism to inspect outgoing remote querier requests.
type MultiTenantConcurrencyController ¶
type MultiTenantConcurrencyController struct {
// contains filtered or unexported fields
}
MultiTenantConcurrencyController instantiates concurrency controllers per tenant that limits the number of concurrent rule evaluations both global and per tenant.
func NewMultiTenantConcurrencyController ¶
func NewMultiTenantConcurrencyController(logger log.Logger, maxGlobalConcurrency int64, ThresholdRuleConcurrency float64, reg prometheus.Registerer, limits RulesLimits) *MultiTenantConcurrencyController
NewMultiTenantConcurrencyController creates a new MultiTenantConcurrencyController.
func (*MultiTenantConcurrencyController) NewTenantConcurrencyControllerFor ¶
func (c *MultiTenantConcurrencyController) NewTenantConcurrencyControllerFor(tenantID string) rules.RuleConcurrencyController
NewTenantConcurrencyControllerFor returns a new rules.RuleConcurrencyController to use for the input tenantID.
type MultiTenantConcurrencyControllerMetrics ¶
type MultiTenantConcurrencyControllerMetrics struct { SlotsInUse *prometheus.GaugeVec AttemptsStartedTotal *prometheus.CounterVec AttemptsIncompleteTotal *prometheus.CounterVec AttemptsCompletedTotal *prometheus.CounterVec }
type MultiTenantManager ¶
type MultiTenantManager interface { // SyncFullRuleGroups is used to sync the Manager with rules from the RuleStore. // If existing user is missing in the ruleGroupsByUser map, its ruler manager will be stopped. SyncFullRuleGroups(ctx context.Context, ruleGroupsByUser map[string]rulespb.RuleGroupList) // SyncPartialRuleGroups syncs the rule groups for the input tenants. // // If a tenant is completely missing from the input ruleGroupsByUser map it doesn't mean their // rule groups config don't exist anymore, so they shouldn't be removed from the ruler. // // If a tenant exists in the map then the list of rule groups must be all the rule groups owned // by this tenant manager (not a partial view). If a tenant exists in the map but its list of rule // groups is empty, then it means there are no rule groups owned by this ruler and it's safe to stop // the tenant's ruler manager. SyncPartialRuleGroups(ctx context.Context, ruleGroupsByUser map[string]rulespb.RuleGroupList) // GetRules fetches rules for a particular tenant (userID). GetRules(userID string) []*promRules.Group // Stop stops all Manager components. Stop() // ValidateRuleGroup validates a rulegroup ValidateRuleGroup(rulefmt.RuleGroup) []error // Start evaluating rules. Start() }
MultiTenantManager is the interface of interaction with a Manager that is tenant aware.
type MultiTenantRuleConcurrencyController ¶
type MultiTenantRuleConcurrencyController interface { // NewTenantConcurrencyControllerFor returns a new rules.RuleConcurrencyController to use for the input tenantID. NewTenantConcurrencyControllerFor(tenantID string) rules.RuleConcurrencyController }
type NoopAppendable ¶
type NoopAppendable struct{}
func NewNoopAppendable ¶
func NewNoopAppendable() *NoopAppendable
type NoopAppender ¶
type NoopAppender struct{}
func (*NoopAppender) AppendCTZeroSample ¶
func (*NoopAppender) AppendExemplar ¶
func (*NoopAppender) AppendHistogram ¶
func (*NoopAppender) AppendHistogramCTZeroSample ¶
func (*NoopAppender) Commit ¶
func (a *NoopAppender) Commit() error
func (*NoopAppender) Rollback ¶
func (a *NoopAppender) Rollback() error
func (*NoopAppender) SetOptions ¶
func (a *NoopAppender) SetOptions(*storage.AppendOptions)
type NoopMultiTenantConcurrencyController ¶
type NoopMultiTenantConcurrencyController struct{}
NoopMultiTenantConcurrencyController is a concurrency controller that does not allow for concurrency.
func (*NoopMultiTenantConcurrencyController) NewTenantConcurrencyControllerFor ¶
func (n *NoopMultiTenantConcurrencyController) NewTenantConcurrencyControllerFor(_ string) rules.RuleConcurrencyController
type NoopTenantConcurrencyController ¶
type NoopTenantConcurrencyController struct{}
NoopTenantConcurrencyController is a concurrency controller that does not allow for concurrency.
func (*NoopTenantConcurrencyController) Done ¶
func (n *NoopTenantConcurrencyController) Done(_ context.Context)
type NotifierConfig ¶
type NotifierConfig struct { TLSEnabled bool `yaml:"tls_enabled" category:"advanced"` TLS tls.ClientConfig `yaml:",inline"` BasicAuth util.BasicAuth `yaml:",inline"` OAuth2 OAuth2Config `yaml:"oauth2"` ProxyURL string `yaml:"proxy_url" category:"advanced"` }
func (*NotifierConfig) RegisterFlags ¶
func (cfg *NotifierConfig) RegisterFlags(f *flag.FlagSet)
type OAuth2Config ¶
type OAuth2Config struct { ClientID string `yaml:"client_id"` ClientSecret flagext.Secret `yaml:"client_secret"` TokenURL string `yaml:"token_url"` Scopes flagext.StringSliceCSV `yaml:"scopes,omitempty"` EndpointParams validation.LimitsMap[string] `yaml:"endpoint_params" category:"advanced"` }
func (*OAuth2Config) IsEnabled ¶
func (cfg *OAuth2Config) IsEnabled() bool
func (*OAuth2Config) RegisterFlagsWithPrefix ¶
func (cfg *OAuth2Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)
type Pusher ¶
type Pusher interface {
Push(context.Context, *mimirpb.WriteRequest) (*mimirpb.WriteResponse, error)
}
Pusher is an ingester server that accepts pushes.
type PusherAppendable ¶
type PusherAppendable struct {
// contains filtered or unexported fields
}
PusherAppendable fulfills the storage.Appendable interface for prometheus manager
func NewPusherAppendable ¶
func NewPusherAppendable(pusher Pusher, userID string, totalWrites, failedWrites prometheus.Counter) *PusherAppendable
type PusherAppender ¶
type PusherAppender struct {
// contains filtered or unexported fields
}
func (*PusherAppender) AppendCTZeroSample ¶
func (*PusherAppender) AppendExemplar ¶
func (*PusherAppender) AppendHistogram ¶
func (*PusherAppender) AppendHistogramCTZeroSample ¶
func (*PusherAppender) Commit ¶
func (a *PusherAppender) Commit() error
func (*PusherAppender) Rollback ¶
func (a *PusherAppender) Rollback() error
func (*PusherAppender) SetOptions ¶
func (a *PusherAppender) SetOptions(*storage.AppendOptions)
type QueryFrontendConfig ¶
type QueryFrontendConfig struct { // Address is the address of the query-frontend to connect to. Address string `yaml:"address"` // GRPCClientConfig contains gRPC specific config options. GRPCClientConfig grpcclient.Config `` /* 130-byte string literal not displayed */ QueryResultResponseFormat string `yaml:"query_result_response_format"` }
QueryFrontendConfig defines query-frontend transport configuration.
func (*QueryFrontendConfig) RegisterFlags ¶
func (c *QueryFrontendConfig) RegisterFlags(f *flag.FlagSet)
func (*QueryFrontendConfig) Validate ¶
func (c *QueryFrontendConfig) Validate() error
type QueryableError ¶
type QueryableError struct {
// contains filtered or unexported fields
}
func (QueryableError) Error ¶
func (q QueryableError) Error() string
func (QueryableError) Unwrap ¶
func (q QueryableError) Unwrap() error
type RemoteQuerier ¶
type RemoteQuerier struct {
// contains filtered or unexported fields
}
RemoteQuerier executes read operations against a httpgrpc.HTTPClient.
func NewRemoteQuerier ¶
func NewRemoteQuerier( client httpgrpc.HTTPClient, timeout time.Duration, preferredQueryResultResponseFormat string, prometheusHTTPPrefix string, logger log.Logger, middlewares ...Middleware, ) *RemoteQuerier
NewRemoteQuerier creates and initializes a new RemoteQuerier instance.
func (*RemoteQuerier) Read ¶
func (q *RemoteQuerier) Read(ctx context.Context, query *prompb.Query, sortSeries bool) (storage.SeriesSet, error)
Read satisfies Prometheus remote.ReadClient. See: https://github.com/prometheus/prometheus/blob/28a830ed9f331e71549c24c2ac3b441033201e8f/storage/remote/client.go#L342
type RingConfig ¶
type RingConfig struct { Common util.CommonRingConfig `yaml:",inline"` NumTokens int `yaml:"num_tokens" category:"advanced"` // Used for testing SkipUnregister bool `yaml:"-"` }
RingConfig masks the ring lifecycler config which contains many options not really required by the rulers ring. This config is used to strip down the config to the minimum, and avoid confusion to the user.
func (*RingConfig) RegisterFlags ¶
func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet, logger log.Logger)
RegisterFlags adds the flags required to config this to the given FlagSet
func (*RingConfig) ToLifecyclerConfig ¶
func (cfg *RingConfig) ToLifecyclerConfig(logger log.Logger) (ring.BasicLifecyclerConfig, error)
ToLifecyclerConfig returns a LifecyclerConfig based on the ruler ring config.
type RuleDiscovery ¶
type RuleDiscovery struct { RuleGroups []*RuleGroup `json:"groups"` NextToken string `json:"groupNextToken,omitempty"` }
RuleDiscovery has info for all rules
type RuleGroup ¶
type RuleGroup struct { Name string `json:"name"` File string `json:"file"` // In order to preserve rule ordering, while exposing type (alerting or recording) // specific properties, both alerting and recording rules are exposed in the // same array. Rules []rule `json:"rules"` Interval float64 `json:"interval"` LastEvaluation time.Time `json:"lastEvaluation"` EvaluationTime float64 `json:"evaluationTime"` SourceTenants []string `json:"sourceTenants"` }
RuleGroup has info for rules which are part of a group
type RuleStateDesc ¶
type RuleStateDesc struct { Rule *rulespb.RuleDesc `protobuf:"bytes,1,opt,name=rule,proto3" json:"rule,omitempty"` State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` Health string `protobuf:"bytes,3,opt,name=health,proto3" json:"health,omitempty"` LastError string `protobuf:"bytes,4,opt,name=lastError,proto3" json:"lastError,omitempty"` Alerts []*AlertStateDesc `protobuf:"bytes,5,rep,name=alerts,proto3" json:"alerts,omitempty"` EvaluationTimestamp time.Time `protobuf:"bytes,6,opt,name=evaluationTimestamp,proto3,stdtime" json:"evaluationTimestamp"` EvaluationDuration time.Duration `protobuf:"bytes,7,opt,name=evaluationDuration,proto3,stdduration" json:"evaluationDuration"` }
RuleStateDesc is a proto representation of a Prometheus Rule
func (*RuleStateDesc) Descriptor ¶
func (*RuleStateDesc) Descriptor() ([]byte, []int)
func (*RuleStateDesc) Equal ¶
func (this *RuleStateDesc) Equal(that interface{}) bool
func (*RuleStateDesc) GetAlerts ¶
func (m *RuleStateDesc) GetAlerts() []*AlertStateDesc
func (*RuleStateDesc) GetEvaluationDuration ¶
func (m *RuleStateDesc) GetEvaluationDuration() time.Duration
func (*RuleStateDesc) GetEvaluationTimestamp ¶
func (m *RuleStateDesc) GetEvaluationTimestamp() time.Time
func (*RuleStateDesc) GetHealth ¶
func (m *RuleStateDesc) GetHealth() string
func (*RuleStateDesc) GetLastError ¶
func (m *RuleStateDesc) GetLastError() string
func (*RuleStateDesc) GetRule ¶
func (m *RuleStateDesc) GetRule() *rulespb.RuleDesc
func (*RuleStateDesc) GetState ¶
func (m *RuleStateDesc) GetState() string
func (*RuleStateDesc) GoString ¶
func (this *RuleStateDesc) GoString() string
func (*RuleStateDesc) Marshal ¶
func (m *RuleStateDesc) Marshal() (dAtA []byte, err error)
func (*RuleStateDesc) MarshalToSizedBuffer ¶
func (m *RuleStateDesc) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*RuleStateDesc) ProtoMessage ¶
func (*RuleStateDesc) ProtoMessage()
func (*RuleStateDesc) Reset ¶
func (m *RuleStateDesc) Reset()
func (*RuleStateDesc) Size ¶
func (m *RuleStateDesc) Size() (n int)
func (*RuleStateDesc) String ¶
func (this *RuleStateDesc) String() string
func (*RuleStateDesc) Unmarshal ¶
func (m *RuleStateDesc) Unmarshal(dAtA []byte) error
func (*RuleStateDesc) XXX_DiscardUnknown ¶
func (m *RuleStateDesc) XXX_DiscardUnknown()
func (*RuleStateDesc) XXX_Marshal ¶
func (m *RuleStateDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RuleStateDesc) XXX_Merge ¶
func (m *RuleStateDesc) XXX_Merge(src proto.Message)
func (*RuleStateDesc) XXX_Size ¶
func (m *RuleStateDesc) XXX_Size() int
func (*RuleStateDesc) XXX_Unmarshal ¶
func (m *RuleStateDesc) XXX_Unmarshal(b []byte) error
type Ruler ¶
Ruler evaluates rules.
+---------------------------------------------------------------+ | | | Query +-------------+ | | +------------------> | | | | | Store | | | | +----------------+ | | | | | Rules +-------------+ | | | | | | | | | | | | | | +----+-v----+ Filter +------------+ | | | +-----------> | | | | Ruler | | Ring | | | | <-----------+ | | | +-------+---+ Rules +------------+ | | | | | | | | | | | | Load +-----------------+ | | +--------------> | | | | Manager | | | | | | | +-----------------+ | | | +---------------------------------------------------------------+
func NewRuler ¶
func NewRuler(cfg Config, manager MultiTenantManager, reg prometheus.Registerer, logger log.Logger, store rulestore.RuleStore, limits RulesLimits) (*Ruler, error)
NewRuler creates a new ruler from a distributor and chunk store.
func (*Ruler) AssertMaxRuleGroups ¶
AssertMaxRuleGroups limit has not been reached compared to the current number of total rule groups in input and returns an error if so.
func (*Ruler) AssertMaxRulesPerRuleGroup ¶
AssertMaxRulesPerRuleGroup limit has not been reached compared to the current number of rules in a rule group and namespace combination in input, returns an error if so. If the limit is set to 0 (or less), then there is no limit.
func (*Ruler) DeleteTenantConfiguration ¶
func (r *Ruler) DeleteTenantConfiguration(w http.ResponseWriter, req *http.Request)
func (*Ruler) GetRules ¶
func (r *Ruler) GetRules(ctx context.Context, req RulesRequest) ([]*GroupStateDesc, string, error)
GetRules retrieves the running rules from this ruler and all running rulers in the ring.
func (*Ruler) IsMaxRuleGroupsLimited ¶
IsMaxRuleGroupsLimited returns true if there is a limit set for the max number of rule groups for the tenant and namespace.
func (*Ruler) IsNamespaceProtected ¶
IsNamespaceProtected returns true if the namespace is protected for the given user.
func (*Ruler) ListAllRules ¶
func (r *Ruler) ListAllRules(w http.ResponseWriter, req *http.Request)
func (*Ruler) NotifySyncRulesAsync ¶
NotifySyncRulesAsync enqueue a request to notify this and other rulers to reload the configuration for a given user. This function returns immediately and the request will be executed asynchronously.
This function MUST be exported to let GEM call it too.
func (*Ruler) Rules ¶
func (r *Ruler) Rules(ctx context.Context, in *RulesRequest) (*RulesResponse, error)
Rules implements the gRPC Ruler service.
func (*Ruler) SyncRules ¶
func (r *Ruler) SyncRules(_ context.Context, req *SyncRulesRequest) (*SyncRulesResponse, error)
SyncRules implements the gRPC Ruler service.
type RulerClient ¶
type RulerClient interface { // Rules returns the currently loaded on the ruler instance for the authenticated tenant. Rules(ctx context.Context, in *RulesRequest, opts ...grpc.CallOption) (*RulesResponse, error) // SyncRules requests a ruler to asynchronously re-synchronize the rules of 1+ tenants. SyncRules(ctx context.Context, in *SyncRulesRequest, opts ...grpc.CallOption) (*SyncRulesResponse, error) }
RulerClient is the client API for Ruler service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewRulerClient ¶
func NewRulerClient(cc *grpc.ClientConn) RulerClient
type RulerServer ¶
type RulerServer interface { // Rules returns the currently loaded on the ruler instance for the authenticated tenant. Rules(context.Context, *RulesRequest) (*RulesResponse, error) // SyncRules requests a ruler to asynchronously re-synchronize the rules of 1+ tenants. SyncRules(context.Context, *SyncRulesRequest) (*SyncRulesResponse, error) }
RulerServer is the server API for Ruler service.
type RulesLimits ¶
type RulesLimits interface { EvaluationDelay(userID string) time.Duration RulerTenantShardSize(userID string) int RulerMaxRuleGroupsPerTenant(userID, namespace string) int RulerMaxRulesPerRuleGroup(userID, namespace string) int RulerRecordingRulesEvaluationEnabled(userID string) bool RulerAlertingRulesEvaluationEnabled(userID string) bool RulerSyncRulesOnChangesEnabled(userID string) bool RulerProtectedNamespaces(userID string) []string RulerMaxIndependentRuleEvaluationConcurrencyPerTenant(userID string) int64 }
RulesLimits defines limits used by Ruler.
type RulesManager ¶
type RulesManager interface { // Run starts the rules manager. Blocks until Stop is called. Run() // Stop rules manager. (Unblocks Run.) Stop() // Update rules manager state. Update(interval time.Duration, files []string, externalLabels labels.Labels, externalURL string, groupEvalIterationFunc rules.GroupEvalIterationFunc) error // RuleGroups returns current rules groups. RuleGroups() []*rules.Group }
RulesManager mimics rules.Manager API. Interface is used to simplify tests.
type RulesRequest ¶
type RulesRequest struct { Filter RulesRequest_RuleType `protobuf:"varint,1,opt,name=filter,proto3,enum=ruler.RulesRequest_RuleType" json:"filter,omitempty"` RuleName []string `protobuf:"bytes,2,rep,name=rule_name,json=ruleName,proto3" json:"rule_name,omitempty"` RuleGroup []string `protobuf:"bytes,3,rep,name=rule_group,json=ruleGroup,proto3" json:"rule_group,omitempty"` File []string `protobuf:"bytes,4,rep,name=file,proto3" json:"file,omitempty"` ExcludeAlerts bool `protobuf:"varint,5,opt,name=exclude_alerts,json=excludeAlerts,proto3" json:"exclude_alerts,omitempty"` MaxGroups int32 `protobuf:"varint,6,opt,name=max_groups,json=maxGroups,proto3" json:"max_groups,omitempty"` NextToken string `protobuf:"bytes,7,opt,name=next_token,json=nextToken,proto3" json:"next_token,omitempty"` }
func (*RulesRequest) Descriptor ¶
func (*RulesRequest) Descriptor() ([]byte, []int)
func (*RulesRequest) Equal ¶
func (this *RulesRequest) Equal(that interface{}) bool
func (*RulesRequest) GetExcludeAlerts ¶
func (m *RulesRequest) GetExcludeAlerts() bool
func (*RulesRequest) GetFile ¶
func (m *RulesRequest) GetFile() []string
func (*RulesRequest) GetFilter ¶
func (m *RulesRequest) GetFilter() RulesRequest_RuleType
func (*RulesRequest) GetMaxGroups ¶
func (m *RulesRequest) GetMaxGroups() int32
func (*RulesRequest) GetNextToken ¶
func (m *RulesRequest) GetNextToken() string
func (*RulesRequest) GetRuleGroup ¶
func (m *RulesRequest) GetRuleGroup() []string
func (*RulesRequest) GetRuleName ¶
func (m *RulesRequest) GetRuleName() []string
func (*RulesRequest) GoString ¶
func (this *RulesRequest) GoString() string
func (*RulesRequest) Marshal ¶
func (m *RulesRequest) Marshal() (dAtA []byte, err error)
func (*RulesRequest) MarshalToSizedBuffer ¶
func (m *RulesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*RulesRequest) ProtoMessage ¶
func (*RulesRequest) ProtoMessage()
func (*RulesRequest) Reset ¶
func (m *RulesRequest) Reset()
func (*RulesRequest) Size ¶
func (m *RulesRequest) Size() (n int)
func (*RulesRequest) String ¶
func (this *RulesRequest) String() string
func (*RulesRequest) Unmarshal ¶
func (m *RulesRequest) Unmarshal(dAtA []byte) error
func (*RulesRequest) XXX_DiscardUnknown ¶
func (m *RulesRequest) XXX_DiscardUnknown()
func (*RulesRequest) XXX_Marshal ¶
func (m *RulesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RulesRequest) XXX_Merge ¶
func (m *RulesRequest) XXX_Merge(src proto.Message)
func (*RulesRequest) XXX_Size ¶
func (m *RulesRequest) XXX_Size() int
func (*RulesRequest) XXX_Unmarshal ¶
func (m *RulesRequest) XXX_Unmarshal(b []byte) error
type RulesRequest_RuleType ¶
type RulesRequest_RuleType int32
const ( AnyRule RulesRequest_RuleType = 0 AlertingRule RulesRequest_RuleType = 1 RecordingRule RulesRequest_RuleType = 2 )
func (RulesRequest_RuleType) EnumDescriptor ¶
func (RulesRequest_RuleType) EnumDescriptor() ([]byte, []int)
func (RulesRequest_RuleType) String ¶
func (x RulesRequest_RuleType) String() string
type RulesResponse ¶
type RulesResponse struct {
Groups []*GroupStateDesc `protobuf:"bytes,1,rep,name=groups,proto3" json:"groups,omitempty"`
}
func (*RulesResponse) Descriptor ¶
func (*RulesResponse) Descriptor() ([]byte, []int)
func (*RulesResponse) Equal ¶
func (this *RulesResponse) Equal(that interface{}) bool
func (*RulesResponse) GetGroups ¶
func (m *RulesResponse) GetGroups() []*GroupStateDesc
func (*RulesResponse) GoString ¶
func (this *RulesResponse) GoString() string
func (*RulesResponse) Marshal ¶
func (m *RulesResponse) Marshal() (dAtA []byte, err error)
func (*RulesResponse) MarshalToSizedBuffer ¶
func (m *RulesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*RulesResponse) ProtoMessage ¶
func (*RulesResponse) ProtoMessage()
func (*RulesResponse) Reset ¶
func (m *RulesResponse) Reset()
func (*RulesResponse) Size ¶
func (m *RulesResponse) Size() (n int)
func (*RulesResponse) String ¶
func (this *RulesResponse) String() string
func (*RulesResponse) Unmarshal ¶
func (m *RulesResponse) Unmarshal(dAtA []byte) error
func (*RulesResponse) XXX_DiscardUnknown ¶
func (m *RulesResponse) XXX_DiscardUnknown()
func (*RulesResponse) XXX_Marshal ¶
func (m *RulesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RulesResponse) XXX_Merge ¶
func (m *RulesResponse) XXX_Merge(src proto.Message)
func (*RulesResponse) XXX_Size ¶
func (m *RulesResponse) XXX_Size() int
func (*RulesResponse) XXX_Unmarshal ¶
func (m *RulesResponse) XXX_Unmarshal(b []byte) error
type StringFilterSet ¶
type StringFilterSet map[string]struct{}
func (StringFilterSet) IsFiltered ¶
func (fs StringFilterSet) IsFiltered(val string) bool
IsFiltered returns whether to filter the value or not. If the set is empty, then nothing is filtered.
type SyncRulesRequest ¶
type SyncRulesRequest struct { // The user / tenant IDs for which the rules should be synced. UserIds []string `protobuf:"bytes,1,rep,name=user_ids,json=userIds,proto3" json:"user_ids,omitempty"` }
SyncRulesRequest is the message sent to request a ruler to re-synchronize the rules of 1+ tenants.
func (*SyncRulesRequest) Descriptor ¶
func (*SyncRulesRequest) Descriptor() ([]byte, []int)
func (*SyncRulesRequest) Equal ¶
func (this *SyncRulesRequest) Equal(that interface{}) bool
func (*SyncRulesRequest) GetUserIds ¶
func (m *SyncRulesRequest) GetUserIds() []string
func (*SyncRulesRequest) GoString ¶
func (this *SyncRulesRequest) GoString() string
func (*SyncRulesRequest) Marshal ¶
func (m *SyncRulesRequest) Marshal() (dAtA []byte, err error)
func (*SyncRulesRequest) MarshalToSizedBuffer ¶
func (m *SyncRulesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SyncRulesRequest) ProtoMessage ¶
func (*SyncRulesRequest) ProtoMessage()
func (*SyncRulesRequest) Reset ¶
func (m *SyncRulesRequest) Reset()
func (*SyncRulesRequest) Size ¶
func (m *SyncRulesRequest) Size() (n int)
func (*SyncRulesRequest) String ¶
func (this *SyncRulesRequest) String() string
func (*SyncRulesRequest) Unmarshal ¶
func (m *SyncRulesRequest) Unmarshal(dAtA []byte) error
func (*SyncRulesRequest) XXX_DiscardUnknown ¶
func (m *SyncRulesRequest) XXX_DiscardUnknown()
func (*SyncRulesRequest) XXX_Marshal ¶
func (m *SyncRulesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SyncRulesRequest) XXX_Merge ¶
func (m *SyncRulesRequest) XXX_Merge(src proto.Message)
func (*SyncRulesRequest) XXX_Size ¶
func (m *SyncRulesRequest) XXX_Size() int
func (*SyncRulesRequest) XXX_Unmarshal ¶
func (m *SyncRulesRequest) XXX_Unmarshal(b []byte) error
type SyncRulesResponse ¶
type SyncRulesResponse struct { }
SyncRulesResponse is the message received back for a SyncRulesRequest.
func (*SyncRulesResponse) Descriptor ¶
func (*SyncRulesResponse) Descriptor() ([]byte, []int)
func (*SyncRulesResponse) Equal ¶
func (this *SyncRulesResponse) Equal(that interface{}) bool
func (*SyncRulesResponse) GoString ¶
func (this *SyncRulesResponse) GoString() string
func (*SyncRulesResponse) Marshal ¶
func (m *SyncRulesResponse) Marshal() (dAtA []byte, err error)
func (*SyncRulesResponse) MarshalTo ¶
func (m *SyncRulesResponse) MarshalTo(dAtA []byte) (int, error)
func (*SyncRulesResponse) MarshalToSizedBuffer ¶
func (m *SyncRulesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SyncRulesResponse) ProtoMessage ¶
func (*SyncRulesResponse) ProtoMessage()
func (*SyncRulesResponse) Reset ¶
func (m *SyncRulesResponse) Reset()
func (*SyncRulesResponse) Size ¶
func (m *SyncRulesResponse) Size() (n int)
func (*SyncRulesResponse) String ¶
func (this *SyncRulesResponse) String() string
func (*SyncRulesResponse) Unmarshal ¶
func (m *SyncRulesResponse) Unmarshal(dAtA []byte) error
func (*SyncRulesResponse) XXX_DiscardUnknown ¶
func (m *SyncRulesResponse) XXX_DiscardUnknown()
func (*SyncRulesResponse) XXX_Marshal ¶
func (m *SyncRulesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SyncRulesResponse) XXX_Merge ¶
func (m *SyncRulesResponse) XXX_Merge(src proto.Message)
func (*SyncRulesResponse) XXX_Size ¶
func (m *SyncRulesResponse) XXX_Size() int
func (*SyncRulesResponse) XXX_Unmarshal ¶
func (m *SyncRulesResponse) XXX_Unmarshal(b []byte) error
type TenantConcurrencyController ¶
type TenantConcurrencyController struct {
// contains filtered or unexported fields
}
TenantConcurrencyController is a concurrency controller that limits the number of concurrent rule evaluations per tenant. It also takes into account the global concurrency limit.
func (*TenantConcurrencyController) Allow ¶
func (c *TenantConcurrencyController) Allow(_ context.Context, group *rules.Group, rule rules.Rule) bool
Allow tries to acquire a slot from the concurrency controller.
func (*TenantConcurrencyController) Done ¶
func (c *TenantConcurrencyController) Done(_ context.Context)
Done releases a slot from the concurrency controller.
type TenantFederationConfig ¶
type TenantFederationConfig struct {
Enabled bool `yaml:"enabled"`
}
func (*TenantFederationConfig) RegisterFlags ¶
func (cfg *TenantFederationConfig) RegisterFlags(f *flag.FlagSet)
type UnimplementedRulerServer ¶
type UnimplementedRulerServer struct { }
UnimplementedRulerServer can be embedded to have forward compatible implementations.
func (*UnimplementedRulerServer) Rules ¶
func (*UnimplementedRulerServer) Rules(ctx context.Context, req *RulesRequest) (*RulesResponse, error)
func (*UnimplementedRulerServer) SyncRules ¶
func (*UnimplementedRulerServer) SyncRules(ctx context.Context, req *SyncRulesRequest) (*SyncRulesResponse, error)
Source Files ¶
- api.go
- client_pool.go
- compat.go
- manager.go
- manager_metrics.go
- mapper.go
- namespace_protection.go
- notifier.go
- remotequerier.go
- remotequerier_decoder.go
- rule_concurrency.go
- rule_query_consistency.go
- ruler.go
- ruler.pb.go
- ruler_ring.go
- ruler_sync_queue.go
- service_discovery.go
- storage.go
- tenant_federation.go