metrics_provider

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package metrics_provider implements a custom metrics server which exposes shoot kube-apiserver pod data available in a input_data_registry.InputDataSource.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsProvider

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

MetricsProvider implements provider.CustomMetricsProvider

func NewMetricsProvider

func NewMetricsProvider(
	dataSource input_data_registry.InputDataSource,
	maxSampleAge time.Duration,
	maxSampleGap time.Duration) *MetricsProvider

NewMetricsProvider creates a MetricsProvider which relies on the specified input_data_registry.InputDataSource as source of data.

maxSampleAge - If a data sample is older than that, it will not be considered when calculating metrics.

maxSampleGap - When calculating metrics based on difference between two samples, if the samples are further apart than this, they will not be considered.

func (*MetricsProvider) GetMetricByName

GetMetricByName implements provider.CustomMetricsProvider.GetMetricByName.

func (*MetricsProvider) GetMetricBySelector

func (mp *MetricsProvider) GetMetricBySelector(
	_ context.Context,
	namespace string,
	podSelector labels.Selector,
	metricInfo provider.CustomMetricInfo,
	_ labels.Selector) (*custom_metrics.MetricValueList, error)

GetMetricBySelector implements provider.CustomMetricsProvider.GetMetricBySelector.

func (*MetricsProvider) ListAllMetrics

func (mp *MetricsProvider) ListAllMetrics() []provider.CustomMetricInfo

ListAllMetrics implements provider.CustomMetricsProvider.ListAllMetrics.

type MetricsProviderService

type MetricsProviderService struct {
	basecmd.AdapterBase // AdapterBase provides a metrics server framework
	// contains filtered or unexported fields
}

MetricsProviderService is the main type of the package. It runs a custom metrics server, which exposes shoot kube-apiserver pod data available in a input_data_registry.InputDataSource. No more than one instance of this type is meant to exist per process.

func NewMetricsProviderService

func NewMetricsProviderService() *MetricsProviderService

NewMetricsProviderService creates a partially initialised MetricsProviderService instance. Initialisation is completed via subsequent calls to the AddCLIFlags() and CompleteCLIConfiguration() methods.

func (*MetricsProviderService) AddCLIFlags

func (mps *MetricsProviderService) AddCLIFlags(cliFlagSet *pflag.FlagSet)

AddCLIFlags adds to the specified flag set the flags necessary to configure this MetricsProviderService instance.

func (*MetricsProviderService) CompleteCLIConfiguration

func (mps *MetricsProviderService) CompleteCLIConfiguration(
	dataSource input_data_registry.InputDataSource, parentLogger logr.Logger) error

CompleteCLIConfiguration sets the logger and dataSource to be used for the rest of the object's lifetime, and then completes CLI configuration, applying the CLI options. This late configuration (not in constructor) is forced by [cmd.AdapterBase]'s design. It requires early instantiation (before CLI configuration has been parsed), so it can do its own CLI parameter processing.

Jump to

Keyboard shortcuts

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