ruler

package
v0.0.0-...-80e4d6b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 106 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OverrideProtectionHeader  = "X-Mimir-Ruler-Override-Namespace-Protection"
	ProtectedNamespacesHeader = "X-Mimir-Ruler-Protected-Namespaces"
)
View Source
const (
	// RulerRingKey is the key under which we store the rulers ring in the KVStore.
	RulerRingKey = "ring"
)
View Source
const TenantFederationFlag = "ruler.tenant-federation.enabled"

Variables

View Source
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")
)
View Source
var (
	ErrNoProtectionOverrideHeader = errors.New("no protection override header")
	ErrNamespaceTargetNotMatch    = errors.New("namespace does not match target")
)
View Source
var (
	ErrInvalidLengthRuler = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRuler   = fmt.Errorf("proto: integer overflow")
)
View Source
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
	})
)
View Source
var RulesRequest_RuleType_name = map[int32]string{
	0: "AnyRule",
	1: "AlertingRule",
	2: "RecordingRule",
}
View Source
var RulesRequest_RuleType_value = map[string]int32{
	"AnyRule":       0,
	"AlertingRule":  1,
	"RecordingRule": 2,
}

Functions

func AllowProtectionOverride

func AllowProtectionOverride(reqHeaders http.Header, namespace string) error

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

func ExtractTenantIDs(ctx context.Context) (string, error)

ExtractTenantIDs gets the rule group org ID from the context.

func FederatedGroupContextFunc

func FederatedGroupContextFunc(ctx context.Context, g *rules.Group) context.Context

FederatedGroupContextFunc prepares the context for federated rules. It injects g.SourceTenants() in to the context to be used by mergeQuerier.

func FilterRuleGroupsByNotMissing

func FilterRuleGroupsByNotMissing(configs map[string]rulespb.RuleGroupList, missing rulespb.RuleGroupList, logger log.Logger) (filtered map[string]rulespb.RuleGroupList)

FilterRuleGroupsByNotMissing filters out from the input configs all the rules groups which are in the missing list.

This function doesn't modify the input configs in place (even if it could) in order to reduce the likelihood of introducing future bugs, in case the rule groups will be cached in memory.

func MetricsQueryFunc

func MetricsQueryFunc(qf rules.QueryFunc, queries, failedQueries prometheus.Counter, remoteQuerier bool) rules.QueryFunc

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

func ProtectedNamespacesHeaderFromSet(namespacesSet map[string]struct{}) http.Header

ProtectedNamespacesHeaderFromSet returns a http.Header with the given namespaces command-separated as the value and ProtectedNamespacesHeader as the key.

func ProtectedNamespacesHeaderFromString

func ProtectedNamespacesHeaderFromString(namespace string) http.Header

ProtectedNamespacesHeaderFromString returns a http.Header with the given namespace as the value and ProtectedNamespacesHeader as the key.

func RecordAndReportRuleQueryMetrics

func RecordAndReportRuleQueryMetrics(qf rules.QueryFunc, queryTime, zeroFetchedSeriesCount prometheus.Counter, logger log.Logger) rules.QueryFunc

func RegisterRulerServer

func RegisterRulerServer(s *grpc.Server, srv RulerServer)

func TenantFederationQueryFunc

func TenantFederationQueryFunc(regularQueryable, federatedQueryable rules.QueryFunc) rules.QueryFunc

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

func WrapQueryFuncWithReadConsistency(fn rules.QueryFunc, logger log.Logger) rules.QueryFunc

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 WrapQueryableErrors(err error) error

func WrapQueryableWithReadConsistency

func WrapQueryableWithReadConsistency(q storage.Queryable, logger log.Logger) storage.Queryable

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 NewAPI

func NewAPI(r *Ruler, s rulestore.RuleStore, logger log.Logger) *API

NewAPI returns a new API struct with the provided ruler and rule store

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) ListRules

func (a *API) ListRules(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) MarshalTo

func (m *AlertStateDesc) MarshalTo(dAtA []byte) (int, 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

func (cfg *Config) RegisterFlags(f *flag.FlagSet, logger log.Logger)

RegisterFlags adds the flags required to config this to the given FlagSet

func (*Config) Validate

func (cfg *Config) Validate(limits validation.Limits) error

Validate config and returns error on failure

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) MarshalTo

func (m *GroupStateDesc) MarshalTo(dAtA []byte) (int, 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
	GroupLastRuleDurationSum *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

func (*NoopAppendable) Appender

Appender returns a storage.Appender.

type NoopAppender

type NoopAppender struct{}

func (*NoopAppender) Append

func (*NoopAppender) AppendCTZeroSample

func (a *NoopAppender) AppendCTZeroSample(_ storage.SeriesRef, _ labels.Labels, _, _ int64) (storage.SeriesRef, error)

func (*NoopAppender) AppendExemplar

func (*NoopAppender) AppendHistogram

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)

func (*NoopAppender) UpdateMetadata

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) Allow

func (*NoopTenantConcurrencyController) Done

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

func (*PusherAppendable) Appender

func (t *PusherAppendable) Appender(ctx context.Context) storage.Appender

Appender returns a storage.Appender

type PusherAppender

type PusherAppender struct {
	// contains filtered or unexported fields
}

func (*PusherAppender) Append

func (*PusherAppender) AppendCTZeroSample

func (a *PusherAppender) AppendCTZeroSample(_ storage.SeriesRef, _ labels.Labels, _, _ int64) (storage.SeriesRef, error)

func (*PusherAppender) AppendExemplar

func (*PusherAppender) AppendHistogram

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)

func (*PusherAppender) UpdateMetadata

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) Query

func (q *RemoteQuerier) Query(ctx context.Context, qs string, t time.Time) (promql.Vector, error)

Query performs a query for the given time.

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) MarshalTo

func (m *RuleStateDesc) MarshalTo(dAtA []byte) (int, 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

type Ruler struct {
	services.Service
	// contains filtered or unexported fields
}

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

func (r *Ruler) AssertMaxRuleGroups(userID, namespace string, rg int) error

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

func (r *Ruler) AssertMaxRulesPerRuleGroup(userID, namespace string, rules int) error

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

func (r *Ruler) IsMaxRuleGroupsLimited(userID, namespace string) bool

IsMaxRuleGroupsLimited returns true if there is a limit set for the max number of rule groups for the tenant and namespace.

func (*Ruler) IsNamespaceProtected

func (r *Ruler) IsNamespaceProtected(userID string, namespace string) bool

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

func (r *Ruler) NotifySyncRulesAsync(userID string)

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) ServeHTTP

func (r *Ruler) ServeHTTP(w http.ResponseWriter, req *http.Request)

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) MarshalTo

func (m *RulesRequest) MarshalTo(dAtA []byte) (int, 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) MarshalTo

func (m *RulesResponse) MarshalTo(dAtA []byte) (int, 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) MarshalTo

func (m *SyncRulesRequest) MarshalTo(dAtA []byte) (int, 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

Allow tries to acquire a slot from the concurrency controller.

func (*TenantConcurrencyController) Done

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) SyncRules

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL