generic

package
v0.0.0-...-7983b3b Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerCheckFactory

func ContainerCheckFactory() check.Check

ContainerCheckFactory is exported for integration testing

Types

type ContainerCheck

type ContainerCheck struct {
	core.CheckBase
	// contains filtered or unexported fields
}

ContainerCheck generates metrics for all containers

func (*ContainerCheck) Configure

func (c *ContainerCheck) Configure(config, initConfig integration.Data, source string) error

Configure parses the check configuration and init the check

func (*ContainerCheck) Run

func (c *ContainerCheck) Run() error

Run executes the check

type ContainerConfig

type ContainerConfig struct{}

ContainerConfig holds the check configuration

func (*ContainerConfig) Parse

func (c *ContainerConfig) Parse(data []byte) error

Parse parses the container check config and set default values

type ContainerLister

type ContainerLister interface {
	List() ([]*workloadmeta.Container, error)
}

ContainerLister abstracts away how to list all known containers

type GenericMetricsAdapter

type GenericMetricsAdapter struct{}

GenericMetricsAdapter implements MetricsAdapter API in a basic way. Adds `runtime` tag and do not change metrics.

func (GenericMetricsAdapter) AdaptMetrics

func (a GenericMetricsAdapter) AdaptMetrics(metricName string, value float64) (string, float64)

AdaptMetrics is a passthrough (does not change anything)

func (GenericMetricsAdapter) AdaptTags

func (a GenericMetricsAdapter) AdaptTags(tags []string, c *workloadmeta.Container) []string

AdaptTags adds a `runtime` tag for all containers

type MetadataContainerLister

type MetadataContainerLister struct{}

MetadataContainerLister implements ContainerLister interface using Workload meta service

func (MetadataContainerLister) List

List returns all known containers

type MetricsAdapter

type MetricsAdapter interface {
	// AdaptTags can be used to change Tagger tags before submitting the metrics
	AdaptTags(tags []string, c *workloadmeta.Container) []string
	// AdaptMetrics can be used to change metrics (change name or value) before submitting the metric.
	AdaptMetrics(metricName string, value float64) (string, float64)
}

MetricsAdapter provides a way to change metrics and tags before sending them out

type Processor

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

Processor contains the core logic of the generic check, allowing reusability

func NewProcessor

func NewProcessor(provider metrics.Provider, lister ContainerLister, adapter MetricsAdapter, filter *containers.Filter) Processor

NewProcessor creates a new processor

func (*Processor) Run

func (p *Processor) Run(sender aggregator.Sender, cacheValidity time.Duration) error

Run executes the check

Jump to

Keyboard shortcuts

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