manager

package
v0.0.0-...-360277a Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlertForStateMetricName = "ALERTS_FOR_STATE"
)

Variables

This section is empty.

Functions

func ForStateMetric

func ForStateMetric(base labels.Labels, alertName string) labels.Labels

func MemstoreTenantManager

func MemstoreTenantManager(
	cfg ruler.Config,
	engine *logql.Engine,
	overrides RulesLimits,
) ruler.ManagerFactory

func MultiTenantManagerAdapter

func MultiTenantManagerAdapter(mgr ruler.MultiTenantManager) ruler.MultiTenantManager

MultiTenantManagerAdapter will wrap a MultiTenantManager which validates loki rules

func ValidateGroups

func ValidateGroups(grps ...rulefmt.RuleGroup) (errs []error)

Types

type GroupLoader

type GroupLoader struct{}

func (GroupLoader) Load

func (g GroupLoader) Load(identifier string) (*rulefmt.RuleGroups, []error)

func (GroupLoader) Parse

func (GroupLoader) Parse(query string) (parser.Expr, error)

type MemStore

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

func NewMemStore

func NewMemStore(userID string, queryFunc rules.QueryFunc, metrics *Metrics, cleanupInterval time.Duration, logger log.Logger) *MemStore

func (*MemStore) Querier

func (m *MemStore) Querier(ctx context.Context, mint, maxt int64) (storage.Querier, error)

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.

func (*MemStore) Start

func (m *MemStore) Start(iter RuleIter)

Calling Start will set the RuleIter, unblock the MemStore, and start the run() function in a separate goroutine.

func (*MemStore) Stop

func (m *MemStore) Stop()

type Metrics

type Metrics struct {
	Evaluations *prometheus.CounterVec
	Samples     prometheus.Gauge       // in memory samples
	CacheHits   *prometheus.CounterVec // cache hits on in memory samples
}

func NewMetrics

func NewMetrics(r prometheus.Registerer) *Metrics

type MultiTenantManager

type MultiTenantManager struct {
	ruler.MultiTenantManager
}

MultiTenantManager wraps a cortex MultiTenantManager but validates loki rules

func (*MultiTenantManager) ValidateRuleGroup

func (m *MultiTenantManager) ValidateRuleGroup(grp rulefmt.RuleGroup) []error

ValidateRuleGroup validates a rulegroup

type NoopAppender

type NoopAppender struct{}

func (NoopAppender) Add

func (a NoopAppender) Add(l labels.Labels, t int64, v float64) (uint64, error)

func (NoopAppender) AddFast

func (a NoopAppender) AddFast(ref uint64, t int64, v float64) error

func (NoopAppender) Appender

func (NoopAppender) Commit

func (a NoopAppender) Commit() error

func (NoopAppender) Rollback

func (a NoopAppender) Rollback() error

type RuleCache

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

func NewRuleCache

func NewRuleCache(metrics *Metrics) *RuleCache

func (*RuleCache) CleanupOldSamples

func (c *RuleCache) CleanupOldSamples(olderThan time.Time) (empty bool)

CleanupOldSamples removes samples that are outside of the rule's `For` duration.

func (*RuleCache) Get

func (c *RuleCache) Get(ts time.Time, ls labels.Labels) (*promql.Sample, bool)

Get returns ok if that timestamp's result is cached.

func (*RuleCache) Set

func (c *RuleCache) Set(ts time.Time, vec promql.Vector)

type RuleIter

type RuleIter interface {
	AlertingRules() []*rules.AlertingRule
}

type RulesLimits

type RulesLimits interface {
	EvaluationDelay(usedID string) time.Duration
}

RulesLimits is the one function we need from limits.Overrides, and is here to limit coupling.

Jump to

Keyboard shortcuts

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