ruler

package
v0.0.0-...-90d47c1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2018 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	http.Handler
	// contains filtered or unexported fields
}

API implements the configs api.

func NewAPI

func NewAPI(db db.RulesDB) *API

NewAPI creates a new API.

func NewAPIFromConfig

func NewAPIFromConfig(cfg db.Config) (*API, error)

NewAPIFromConfig makes a new API from our database config.

func (*API) RegisterRoutes

func (a *API) RegisterRoutes(r *mux.Router)

RegisterRoutes registers the configs API HTTP routes with the provided Router.

type Config

type Config struct {
	// This is used for template expansion in alerts; must be a valid URL
	ExternalURL util.URLValue

	// How frequently to evaluate rules by default.
	EvaluationInterval time.Duration
	NumWorkers         int

	// URL of the Alertmanager to send notifications to.
	AlertmanagerURL util.URLValue
	// Whether to use DNS SRV records to discover alertmanagers.
	AlertmanagerDiscovery bool
	// How long to wait between refreshing the list of alertmanagers based on
	// DNS service discovery.
	AlertmanagerRefreshInterval time.Duration

	// Capacity of the queue for notifications to be sent to the Alertmanager.
	NotificationQueueCapacity int
	// HTTP timeout duration when sending notifications to the Alertmanager.
	NotificationTimeout time.Duration
	// Timeout for rule group evaluation, including sending result to ingester
	GroupTimeout 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 ConfigStoreConfig

type ConfigStoreConfig struct {
	DBConfig db.Config

	// DEPRECATED
	ConfigsAPIURL util.URLValue

	// DEPRECATED. HTTP timeout duration for requests made to the Weave Cloud
	// configs service.
	ClientTimeout time.Duration
}

ConfigStoreConfig says where we can find the ruler configs.

func (*ConfigStoreConfig) RegisterFlags

func (cfg *ConfigStoreConfig) 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 Ruler

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

Ruler evaluates rules.

func NewRuler

func NewRuler(cfg Config, d *distributor.Distributor, c *chunk.Store) (*Ruler, error)

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

func (*Ruler) Evaluate

func (r *Ruler) Evaluate(userID string, item *workItem)

Evaluate a list of rules in the given context.

func (*Ruler) Stop

func (r *Ruler) Stop()

Stop stops the Ruler.

type RulesAPI

type RulesAPI interface {
	// GetConfigs returns all Cortex configurations from a configs API server
	// that have been updated after the given configs.ID was last updated.
	GetConfigs(since configs.ID) (map[string]configs.VersionedRulesConfig, error)
}

RulesAPI is what the ruler needs from a config store to process rules.

func NewRulesAPI

func NewRulesAPI(cfg ConfigStoreConfig) (RulesAPI, error)

NewRulesAPI creates a new RulesAPI.

type ScheduledItem

type ScheduledItem interface {
	Key() string
	// Scheduled returns the earliest possible time the time is available for
	// dequeueing.
	Scheduled() time.Time
}

ScheduledItem is an item in a queue of scheduled items.

type SchedulingQueue

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

SchedulingQueue is like a priority queue, but the first item is the oldest scheduled item. Items are only able to be dequeued after the time they are scheduled to be run.

func NewSchedulingQueue

func NewSchedulingQueue(clock clockwork.Clock) *SchedulingQueue

NewSchedulingQueue makes a new scheduling queue.

func (*SchedulingQueue) Close

func (sq *SchedulingQueue) Close()

Close the scheduling queue. No more items can be added. Items can be dequeued until there are none left.

func (*SchedulingQueue) Dequeue

func (sq *SchedulingQueue) Dequeue() ScheduledItem

Dequeue takes an item from the queue. If there are no items, or the first item isn't ready to be scheduled, it blocks. If there queue is closed, this will return nil.

func (*SchedulingQueue) Enqueue

func (sq *SchedulingQueue) Enqueue(item ScheduledItem)

Enqueue schedules an item for later Dequeueing.

type Server

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

Server is a rules server.

func NewServer

func NewServer(cfg Config, ruler *Ruler, rulesAPI RulesAPI) (*Server, error)

NewServer makes a new rule processing server.

func (*Server) Stop

func (s *Server) Stop()

Stop the server.

type Worker

type Worker interface {
	Run()
	Stop()
}

Worker does a thing until it's told to stop.

Jump to

Keyboard shortcuts

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