metricsstore

package
v2.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsStore

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

MetricsStore implements the k8s.io/client-go/tools/cache.Store interface. Instead of storing entire Kubernetes objects, it stores metrics generated based on those objects.

func NewMetricsStore

func NewMetricsStore(headers []string, generateFunc func(interface{}) []metric.FamilyInterface) *MetricsStore

NewMetricsStore returns a new MetricsStore

func (*MetricsStore) Add

func (s *MetricsStore) Add(obj interface{}) error

Add inserts adds to the MetricsStore by calling the metrics generator functions and adding the generated metrics to the metrics map that underlies the MetricStore.

func (*MetricsStore) Delete

func (s *MetricsStore) Delete(obj interface{}) error

Delete deletes an existing entry in the MetricsStore.

func (*MetricsStore) Get

func (s *MetricsStore) Get(obj interface{}) (item interface{}, exists bool, err error)

Get implements the Get method of the store interface.

func (*MetricsStore) GetByKey

func (s *MetricsStore) GetByKey(key string) (item interface{}, exists bool, err error)

GetByKey implements the GetByKey method of the store interface.

func (*MetricsStore) List

func (s *MetricsStore) List() []interface{}

List implements the List method of the store interface.

func (*MetricsStore) ListKeys

func (s *MetricsStore) ListKeys() []string

ListKeys implements the ListKeys method of the store interface.

func (*MetricsStore) Replace

func (s *MetricsStore) Replace(list []interface{}, _ string) error

Replace will delete the contents of the store, using instead the given list.

func (*MetricsStore) Resync

func (s *MetricsStore) Resync() error

Resync implements the Resync method of the store interface.

func (*MetricsStore) Update

func (s *MetricsStore) Update(obj interface{}) error

Update updates the existing entry in the MetricsStore.

func (*MetricsStore) WriteAll

func (s *MetricsStore) WriteAll(w io.Writer)

WriteAll writes all metrics of the store into the given writer, zipped with the help text of each metric family.

type MetricsWriter added in v2.1.1

type MetricsWriter interface {
	WriteAll(w io.Writer)
}

MetricsWriter is the interface that wraps the WriteAll method. WriteAll writes out bytes to the underlying writer.

func NewMultiStoreMetricsWriter added in v2.1.1

func NewMultiStoreMetricsWriter(stores []*MetricsStore) MetricsWriter

NewMultiStoreMetricsWriter creates a new MultiStoreMetricsWriter.

type MultiStoreMetricsWriter added in v2.1.1

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

MultiStoreMetricsWriter is a struct that holds multiple MetricsStore(s) and implements the MetricsWriter interface. It should be used with stores which have the same metric headers.

MultiStoreMetricsWriter writes out metrics from the underlying stores so that metrics with the same name coming from different stores end up grouped together. It also ensures that the metric headers are only written out once.

func (MultiStoreMetricsWriter) WriteAll added in v2.1.1

func (m MultiStoreMetricsWriter) WriteAll(w io.Writer)

WriteAll writes out metrics from the underlying stores to the given writer.

WriteAll writes metrics so that the ones with the same name are grouped together when written out.

Jump to

Keyboard shortcuts

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