selector

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: MIT Imports: 5 Imported by: 4

Documentation

Overview

Package selector implements backend endpoint selection for multi-prometheus deployments

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterStrategy

func RegisterStrategy(name string, factory func(args ...string) (Strategy, error))

RegisterStrategy registers a selector strategy

Types

type Result

type Result struct {
	Selection  []*url.URL
	Candidates []*locator.PrometheusEndpoint
}

Result encapsulates a selection result, including the candidate endpoints considered

func (*Result) String

func (r *Result) String() string

type Selector

type Selector struct {
	Strategy Strategy
	// contains filtered or unexported fields
}

Selector is a puggable interface for viable prometheus endpoints

func NewSelector

func NewSelector(locators []locator.Locator, strategyArgs ...string) (*Selector, error)

NewSelector returns a new Selector instance of the specified type

func (*Selector) Select

func (s *Selector) Select() (result *Result, err error)

Select performs selection of a/all viable prometheus endpoint target(s)

type Strategy

type Strategy interface {
	// Select chooses elligible prometheus endpoints out of the provided set, marking
	// the 'Selected' flag on the chosen items, and optionally, setting the 'Error' flag
	// on items that cannot be evaluated
	Select(endpoints []*locator.PrometheusEndpoint) (err error)
	// Name provides the (unique) name of this strategy
	Name() string
	// Description provides a human-readable description for this strategy
	Description() string
	// ComparisonMetricName gets the name of the comparison metric/calculation used to make a selection
	ComparisonMetricName() string
	// NextIndex returns the index of the target that should be used to field the next request
	NextIndex(targets []*url.URL) int
}

Strategy is a puggable interface for strategies to select viable prometheus endpoints

Directories

Path Synopsis
strategy
minimumhistory
Package minimumhistory implements target selection for multi-prometheus deployments by selecting an instance at random with a minimum amount of history available, and with sticky-session support
Package minimumhistory implements target selection for multi-prometheus deployments by selecting an instance at random with a minimum amount of history available, and with sticky-session support
random
Package random implements target selection for multi-prometheus deployments by selecting an instance at random with sticky-session support
Package random implements target selection for multi-prometheus deployments by selecting an instance at random with sticky-session support
singlemostdata
Package singlemostdata implements target selection for multi-prometheus deployments by selecting a single instance with the most available data
Package singlemostdata implements target selection for multi-prometheus deployments by selecting a single instance with the most available data

Jump to

Keyboard shortcuts

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