collectors

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNothingYet = &retry.Error{
	LogicError:    errors.New("No collector detected"),
	RessourceName: "detector",
	RetryStatus:   retry.FailWillRetry,
}

ErrNothingYet is returned when no collector is currently detected. This might change in the future if new collectors are valid.

View Source
var ErrPermaFail = &retry.Error{
	LogicError:    errors.New("No collector available"),
	RessourceName: "detector",
	RetryStatus:   retry.PermaFail,
}

ErrPermaFail is returned when all candidates have permanently failed.

Functions

This section is empty.

Types

type CFCollector

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

CFCollector lists containers from local rep, and fetch performance metrics from garden

func (*CFCollector) Detect

func (c *CFCollector) Detect() error

Detect tries to connect to local garden, and returns success

func (*CFCollector) List

func (c *CFCollector) List() ([]*containers.Container, error)

List gets all running containers

func (*CFCollector) UpdateMetrics

func (c *CFCollector) UpdateMetrics(cList []*containers.Container) error

UpdateMetrics updates metrics on an existing list of containers

type Catalog

type Catalog map[string]CollectorFactory

Catalog holds available collectors for detection and usage

type Collector

type Collector interface {
	Detect() error
	List() ([]*containers.Container, error)
	UpdateMetrics([]*containers.Container) error
}

Collector is the public interface to container collectors must implement

type CollectorFactory

type CollectorFactory func() Collector

CollectorFactory is functions that return a Collector

type CollectorPriority

type CollectorPriority int

CollectorPriority helps resolving dupe tags from collectors

const (
	NodeRuntime CollectorPriority = iota
	NodeOrchestrator
)

List of collector priorities Same order as the tagger: docker < kubelet

type Detector

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

Detector holds the logic to initialise collectors, with retries, and selecting the most appropriate among available collectors

func NewDetector

func NewDetector(configuredName string) *Detector

NewDetector returns a Detector ready to use. If configuredName is empty, autodetection is enabled. If not, only the one name will be tried.

func (*Detector) GetPreferred

func (d *Detector) GetPreferred() (Collector, string, error)

GetPreferred detects, ranks and returns the best collector for now. Result might change if new collectors are valid after start, then constant when all collectors are either ok or PermaFail. Users should keep calling this method instead of caching the first result.

Jump to

Keyboard shortcuts

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