Documentation ¶
Index ¶
- Constants
- func ForStateMetric(base labels.Labels, alertName string) labels.Labels
- func MultiTenantManagerAdapter(mgr ruler.MultiTenantManager) ruler.MultiTenantManager
- func MultiTenantRuleManager(cfg Config, engine *logql.Engine, overrides RulesLimits, logger log.Logger, ...) ruler.ManagerFactory
- func NewRuler(cfg Config, engine *logql.Engine, reg prometheus.Registerer, logger log.Logger, ...) (*ruler.Ruler, error)
- func ValidateGroups(grps ...rulefmt.RuleGroup) (errs []error)
- type Config
- type GroupLoader
- type MemStore
- type MultiTenantManager
- type RemoteWriteConfig
- type RuleCache
- type RuleIter
- type RulesLimits
Constants ¶
const (
AlertForStateMetricName = "ALERTS_FOR_STATE"
)
const MetricsPrefix = "loki_ruler_wal_"
MetricsPrefix defines the prefix to use for all metrics in this package
Variables ¶
This section is empty.
Functions ¶
func MultiTenantManagerAdapter ¶
func MultiTenantManagerAdapter(mgr ruler.MultiTenantManager) ruler.MultiTenantManager
MultiTenantManagerAdapter will wrap a MultiTenantManager which validates loki rules
func MultiTenantRuleManager ¶
func MultiTenantRuleManager(cfg Config, engine *logql.Engine, overrides RulesLimits, logger log.Logger, reg prometheus.Registerer) ruler.ManagerFactory
func NewRuler ¶
func NewRuler(cfg Config, engine *logql.Engine, reg prometheus.Registerer, logger log.Logger, ruleStore rulestore.RuleStore, limits RulesLimits) (*ruler.Ruler, error)
func ValidateGroups ¶
Types ¶
type Config ¶
type Config struct { ruler.Config `yaml:",inline"` WAL instance.Config `yaml:"wal,omitempty"` WALCleaner cleaner.Config `yaml:"wal_cleaner,omitempty"` RemoteWrite RemoteWriteConfig `yaml:"remote_write,omitempty"` }
func (*Config) RegisterFlags ¶
type GroupLoader ¶
type GroupLoader struct{}
func (GroupLoader) Load ¶
func (g GroupLoader) Load(identifier string) (*rulefmt.RuleGroups, []error)
type MemStore ¶
type MemStore struct {
// contains filtered or unexported fields
}
func NewMemStore ¶
func (*MemStore) Querier ¶
implement storage.Queryable. It is only called with the desired ts as maxtime. Mint is parameterized via the outage tolerance, but since we're synthetically generating these, we only care about the desired time.
type MultiTenantManager ¶
type MultiTenantManager struct {
// contains filtered or unexported fields
}
MultiTenantManager wraps a cortex MultiTenantManager but validates loki rules
func (*MultiTenantManager) GetRules ¶
func (m *MultiTenantManager) GetRules(userID string) []*rules.Group
func (*MultiTenantManager) Stop ¶
func (m *MultiTenantManager) Stop()
func (*MultiTenantManager) SyncRuleGroups ¶
func (m *MultiTenantManager) SyncRuleGroups(ctx context.Context, ruleGroups map[string]rulespb.RuleGroupList)
func (*MultiTenantManager) ValidateRuleGroup ¶
func (m *MultiTenantManager) ValidateRuleGroup(grp rulefmt.RuleGroup) []error
ValidateRuleGroup validates a rulegroup
type RemoteWriteConfig ¶
type RemoteWriteConfig struct { Client config.RemoteWriteConfig `yaml:"client"` Enabled bool `yaml:"enabled"` ConfigRefreshPeriod time.Duration `yaml:"config_refresh_period"` }
func (*RemoteWriteConfig) Clone ¶
func (c *RemoteWriteConfig) Clone() (*RemoteWriteConfig, error)
func (*RemoteWriteConfig) RegisterFlags ¶
func (c *RemoteWriteConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags adds the flags required to config this to the given FlagSet.
func (*RemoteWriteConfig) Validate ¶
func (c *RemoteWriteConfig) Validate() error
type RuleCache ¶
type RuleCache struct {
// contains filtered or unexported fields
}
func NewRuleCache ¶
func NewRuleCache(metrics *memstoreMetrics) *RuleCache
func (*RuleCache) CleanupOldSamples ¶
CleanupOldSamples removes samples that are outside of the rule's `For` duration.
type RuleIter ¶
type RuleIter interface {
AlertingRules() []*rules.AlertingRule
}
type RulesLimits ¶
type RulesLimits interface { ruler.RulesLimits RulerRemoteWriteDisabled(userID string) bool RulerRemoteWriteURL(userID string) string RulerRemoteWriteTimeout(userID string) time.Duration RulerRemoteWriteHeaders(userID string) map[string]string RulerRemoteWriteRelabelConfigs(userID string) []*util.RelabelConfig RulerRemoteWriteQueueCapacity(userID string) int RulerRemoteWriteQueueMinShards(userID string) int RulerRemoteWriteQueueMaxShards(userID string) int RulerRemoteWriteQueueMaxSamplesPerSend(userID string) int RulerRemoteWriteQueueBatchSendDeadline(userID string) time.Duration RulerRemoteWriteQueueMinBackoff(userID string) time.Duration RulerRemoteWriteQueueMaxBackoff(userID string) time.Duration RulerRemoteWriteQueueRetryOnRateLimit(userID string) bool }
RulesLimits is the one function we need from limits.Overrides, and is here to limit coupling.
Directories ¶
Path | Synopsis |
---|---|
storage
|
|
cleaner
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics.
|
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics. |
instance
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics.
|
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics. |
util
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics.
|
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics. |
wal
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics.
|
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics. |