ruler

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: Apache-2.0 Imports: 45 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRuleStorage added in v0.6.0

func NewRuleStorage(cfg RuleStoreConfig) (rules.RuleStore, error)

NewRuleStorage returns a new rule storage backend poller and store

Types

type Config

type Config struct {
	ExternalURL        flagext.URLValue // This is used for template expansion in alerts; must be a valid URL
	EvaluationInterval time.Duration    // How frequently to evaluate rules by default.
	PollInterval       time.Duration    // How frequently to poll for updated rules
	StoreConfig        RuleStoreConfig  // Rule Storage and Polling configuration
	RulePath           string           // Path to store rule files for prom manager

	AlertmanagerURL             flagext.URLValue // URL of the Alertmanager to send notifications to.
	AlertmanagerDiscovery       bool             // Whether to use DNS SRV records to discover alertmanagers.
	AlertmanagerRefreshInterval time.Duration    // How long to wait between refreshing the list of alertmanagers based on DNS service discovery.
	AlertmanangerEnableV2API    bool             // Enables the ruler notifier to use the alertmananger V2 API
	NotificationQueueCapacity   int              // Capacity of the queue for notifications to be sent to the Alertmanager.
	NotificationTimeout         time.Duration    // HTTP timeout duration when sending notifications to the Alertmanager.

	EnableSharding   bool // Enable sharding rule groups
	SearchPendingFor time.Duration
	Ring             RingConfig
	FlushCheckPeriod time.Duration
}

Config is the configuration for the recording rules server.

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

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

type Pusher

type Pusher interface {
	Push(context.Context, *client.WriteRequest) (*client.WriteResponse, error)
}

Pusher is an ingester server that accepts pushes.

type RingConfig added in v0.6.0

type RingConfig struct {
	KVStore          kv.Config     `yaml:"kvstore,omitempty"`
	HeartbeatPeriod  time.Duration `yaml:"heartbeat_period,omitempty"`
	HeartbeatTimeout time.Duration `yaml:"heartbeat_timeout,omitempty"`

	// Instance details
	InstanceID             string   `yaml:"instance_id" doc:"hidden"`
	InstanceInterfaceNames []string `yaml:"instance_interface_names" doc:"hidden"`
	InstancePort           int      `yaml:"instance_port" doc:"hidden"`
	InstanceAddr           string   `yaml:"instance_addr" doc:"hidden"`
	NumTokens              int      `yaml:"num_tokens"`

	// Injected internally
	ListenPort int `yaml:"-"`

	// 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 added in v0.6.0

func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet)

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

func (*RingConfig) ToLifecyclerConfig added in v0.6.0

func (cfg *RingConfig) ToLifecyclerConfig() ring.LifecyclerConfig

ToLifecyclerConfig returns a LifecyclerConfig based on the ruler ring config.

type RuleStoreConfig added in v0.6.0

type RuleStoreConfig struct {
	Type     string `yaml:"type"`
	ConfigDB client.Config
	// contains filtered or unexported fields
}

RuleStoreConfig conigures a rule store

func (*RuleStoreConfig) RegisterFlags added in v0.6.0

func (cfg *RuleStoreConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers flags.

type Ruler

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

Ruler evaluates rules.

func NewRuler

func NewRuler(cfg Config, engine *promql.Engine, queryable promStorage.Queryable, d *distributor.Distributor) (*Ruler, error)

NewRuler creates a new ruler from a distributor and chunk store.

func (*Ruler) Flush

func (r *Ruler) Flush()

Flush triggers a flush of all the work items currently scheduled by the ruler, currently every ruler will query a backend rule store for it's rules so no flush is required.

func (*Ruler) ServeHTTP

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

func (*Ruler) Stop

func (r *Ruler) Stop()

Stop stops the Ruler. Each function of the ruler is terminated before leaving the ring

func (*Ruler) StopIncomingRequests

func (r *Ruler) StopIncomingRequests()

StopIncomingRequests is called during the shutdown process. Ensure no new rules are scheduled on this Ruler Currently the api is decoupled from the scheduler, no action is required.

func (*Ruler) TransferOut

func (r *Ruler) TransferOut(ctx context.Context) error

TransferOut is a noop for the ruler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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