Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.
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 ¶
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 ¶
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.
type DetectorInterface ¶ added in v0.9.0
DetectorInterface is useful to mock the Detector in other packages