rules

package
v1.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ManagerExistsError    = ManagerStoreError("The manager already exists")
	ManagerNotExistsError = ManagerStoreError("The manager does not exist")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalRuleManager

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

func NewLocalRuleManager

func NewLocalRuleManager(storagePath string, promRuleManagers RuleManagers) *LocalRuleManager

func (*LocalRuleManager) AlertingRules

func (l *LocalRuleManager) AlertingRules() []*rules.AlertingRule

func (*LocalRuleManager) Alertmanagers

func (l *LocalRuleManager) Alertmanagers() []*url.URL

func (*LocalRuleManager) CreateManager

func (l *LocalRuleManager) CreateManager(managerId string, alertManagers *prom_config.AlertmanagerConfigs) (*Manager, error)

func (*LocalRuleManager) DeleteManager

func (l *LocalRuleManager) DeleteManager(managerId string) error

func (*LocalRuleManager) DroppedAlertmanagers

func (l *LocalRuleManager) DroppedAlertmanagers() []*url.URL

func (*LocalRuleManager) RuleGroups

func (l *LocalRuleManager) RuleGroups() []*rules.Group

func (*LocalRuleManager) UpsertRuleGroup

func (l *LocalRuleManager) UpsertRuleGroup(managerId string, ruleGroup *rulesclient.RuleGroup) error

type Manager added in v1.4.1

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

func NewManager added in v1.4.1

func NewManager(id string, alertManagers *prom_config.AlertmanagerConfigs) *Manager

func (*Manager) AlertManagers added in v1.4.1

func (m *Manager) AlertManagers() *prom_config.AlertmanagerConfigs

func (*Manager) Id added in v1.4.1

func (m *Manager) Id() string

type ManagerStoreError

type ManagerStoreError string

func (ManagerStoreError) Error

func (e ManagerStoreError) Error() string

type PromManagerWrapper

type PromManagerWrapper interface {
	Start() error
	Reload() error

	// implements prometheus api v1 rulesRetriever interface
	RuleGroups() []*rules.Group
	AlertingRules() []*rules.AlertingRule

	// implements prometheus api v1 alertmanagerRetriever interface
	Alertmanagers() []*url.URL
	DroppedAlertmanagers() []*url.URL
}

type PromRuleManager

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

func NewPromRuleManager

func NewPromRuleManager(managerId, promRuleFile string, alertManagers *prom_config.AlertmanagerConfigs, evaluationInterval time.Duration, store storage.Storage, engine *promql.Engine, log *logger.Logger, metrics metrics.Registrar, queryTimeout time.Duration) *PromRuleManager

func (*PromRuleManager) AlertingRules

func (r *PromRuleManager) AlertingRules() []*rules.AlertingRule

func (*PromRuleManager) Alertmanagers

func (r *PromRuleManager) Alertmanagers() []*url.URL

func (*PromRuleManager) DroppedAlertmanagers

func (r *PromRuleManager) DroppedAlertmanagers() []*url.URL

func (*PromRuleManager) Reload

func (r *PromRuleManager) Reload() error

func (*PromRuleManager) RuleGroups

func (r *PromRuleManager) RuleGroups() []*rules.Group

func (*PromRuleManager) Start

func (r *PromRuleManager) Start() error

func (*PromRuleManager) Stop

func (r *PromRuleManager) Stop() error

type PromRuleManagers

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

func NewRuleManagers

func NewRuleManagers(store storage.Storage, engine *promql.Engine, evaluationInterval time.Duration, log *logger.Logger, metrics metrics.Registrar, queryTimeout time.Duration) *PromRuleManagers

func (*PromRuleManagers) AlertingRules

func (r *PromRuleManagers) AlertingRules() []*rules.AlertingRule

implements prometheus api v1 rulesRetriever interface

func (*PromRuleManagers) Alertmanagers

func (r *PromRuleManagers) Alertmanagers() []*url.URL

implements prometheus api v1 alertmanagerRetriever interface

func (*PromRuleManagers) Create

func (r *PromRuleManagers) Create(managerId, promRuleFile string, alertManagers *prom_config.AlertmanagerConfigs) error

func (*PromRuleManagers) Delete

func (r *PromRuleManagers) Delete(managerId string) error

func (*PromRuleManagers) DeleteAll

func (r *PromRuleManagers) DeleteAll() error

func (*PromRuleManagers) DroppedAlertmanagers

func (r *PromRuleManagers) DroppedAlertmanagers() []*url.URL

implements prometheus api v1 alertmanagerRetriever interface

func (*PromRuleManagers) Reload

func (r *PromRuleManagers) Reload() error

func (*PromRuleManagers) RuleGroups

func (r *PromRuleManagers) RuleGroups() []*rules.Group

implements prometheus api v1 rulesRetriever interface

type Registerer

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

func NewRegisterer

func NewRegisterer(labels prometheus.Labels, reg prometheus.Registerer) *Registerer

func (*Registerer) MustRegister

func (r *Registerer) MustRegister(cs ...prometheus.Collector)

func (*Registerer) Register

func (r *Registerer) Register(c prometheus.Collector) error

func (*Registerer) Unregister

func (r *Registerer) Unregister(c prometheus.Collector) bool

func (*Registerer) UnregisterAll

func (r *Registerer) UnregisterAll() bool

type RemoteRuleManager

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

func NewRemoteRuleManager

func NewRemoteRuleManager(addr string, tlsConfig *tls.Config) *RemoteRuleManager

func (*RemoteRuleManager) AlertingRules

func (r *RemoteRuleManager) AlertingRules() []*rules.AlertingRule

func (*RemoteRuleManager) Alertmanagers

func (r *RemoteRuleManager) Alertmanagers() []*url.URL

func (*RemoteRuleManager) CreateManager

func (r *RemoteRuleManager) CreateManager(managerId string, alertmanagerConfigs *prom_config.AlertmanagerConfigs) (*Manager, error)

func (*RemoteRuleManager) DeleteManager

func (r *RemoteRuleManager) DeleteManager(managerId string) error

func (*RemoteRuleManager) DroppedAlertmanagers

func (r *RemoteRuleManager) DroppedAlertmanagers() []*url.URL

func (*RemoteRuleManager) RuleGroups

func (r *RemoteRuleManager) RuleGroups() []*rules.Group

func (*RemoteRuleManager) UpsertRuleGroup

func (r *RemoteRuleManager) UpsertRuleGroup(managerId string, ruleGroup *rulesclient.RuleGroup) error

type ReplicatedRuleManager

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

func NewReplicatedRuleManager

func NewReplicatedRuleManager(localRuleManager RuleManager, localIndex int, addrs []string, replicationFactor uint, tlsConfig *tls.Config) *ReplicatedRuleManager

func (*ReplicatedRuleManager) AlertingRules

func (r *ReplicatedRuleManager) AlertingRules() []*rules.AlertingRule

TODO: dedup alerts used for /api/v1/alerts

func (*ReplicatedRuleManager) Alertmanagers

func (r *ReplicatedRuleManager) Alertmanagers() []*url.URL

func (*ReplicatedRuleManager) CreateManager

func (r *ReplicatedRuleManager) CreateManager(managerId string, alertmanagerConfigs *prom_config.AlertmanagerConfigs) (*Manager, error)

func (*ReplicatedRuleManager) DeleteManager

func (r *ReplicatedRuleManager) DeleteManager(managerId string) error

func (*ReplicatedRuleManager) DroppedAlertmanagers

func (r *ReplicatedRuleManager) DroppedAlertmanagers() []*url.URL

func (*ReplicatedRuleManager) RuleGroups

func (r *ReplicatedRuleManager) RuleGroups() []*rules.Group

TODO: dedup rules used for /api/v1/rules

func (*ReplicatedRuleManager) UpsertRuleGroup

func (r *ReplicatedRuleManager) UpsertRuleGroup(managerId string, ruleGroup *rulesclient.RuleGroup) error

type RuleManager

type RuleManager interface {
	CreateManager(managerId string, alertmanagerConfigs *prom_config.AlertmanagerConfigs) (*Manager, error)
	DeleteManager(managerId string) error
	UpsertRuleGroup(managerId string, ruleGroup *rulesclient.RuleGroup) error
	RuleGroups() []*rules.Group
	AlertingRules() []*rules.AlertingRule
	Alertmanagers() []*url.URL
	DroppedAlertmanagers() []*url.URL
}

type RuleManagerFiles added in v1.4.0

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

func NewRuleManagerFiles added in v1.4.0

func NewRuleManagerFiles(rulesStoragePath string) *RuleManagerFiles

func (*RuleManagerFiles) Create added in v1.4.0

func (f *RuleManagerFiles) Create(managerId string, alertManagers *prom_config.AlertmanagerConfigs) (string, error)

func (*RuleManagerFiles) Delete added in v1.4.0

func (f *RuleManagerFiles) Delete(managerId string) error

func (*RuleManagerFiles) Load added in v1.4.0

func (*RuleManagerFiles) UpsertRuleGroup added in v1.4.0

func (f *RuleManagerFiles) UpsertRuleGroup(managerId string, ruleGroup *rulesclient.RuleGroup) error

type RuleManagers

type RuleManagers interface {
	Create(managerId string, managerFile string, alertManagers *prom_config.AlertmanagerConfigs) error
	Delete(managerId string) error
	DeleteAll() error
	Reload() error
	RuleGroups() []*rules.Group
	AlertingRules() []*rules.AlertingRule
	Alertmanagers() []*url.URL
	DroppedAlertmanagers() []*url.URL
}

Jump to

Keyboard shortcuts

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