generator

package
v2.0.0-beta.0...-3bc1883 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposeMetricGenFuncs

func ComposeMetricGenFuncs(familyGens []FamilyGenerator) func(obj interface{}) []metric.FamilyInterface

ComposeMetricGenFuncs takes a slice of metric families and returns a function that composes their metric generation functions into a single one.

func ExtractMetricFamilyHeaders

func ExtractMetricFamilyHeaders(families []FamilyGenerator) []string

ExtractMetricFamilyHeaders takes in a slice of FamilyGenerator metrics and returns the extracted headers.

Types

type FamilyGenerator

type FamilyGenerator struct {
	Name              string
	Help              string
	Type              metric.Type
	DeprecatedVersion string
	GenerateFunc      func(obj interface{}) *metric.Family
}

FamilyGenerator provides everything needed to generate a metric family with a Kubernetes object. DeprecatedVersion is defined only if the metric for which this options applies is, in fact, deprecated.

func FilterMetricFamilies

func FilterMetricFamilies(l allowDenyLister, families []FamilyGenerator) []FamilyGenerator

FilterMetricFamilies takes a allow- and a denylist and a slice of metric families and returns a filtered slice.

func NewFamilyGenerator

func NewFamilyGenerator(name string, help string, metricType metric.Type, deprecatedVersion string, generateFunc func(obj interface{}) *metric.Family) *FamilyGenerator

NewFamilyGenerator creates new FamilyGenerator instances.

func (*FamilyGenerator) Generate

func (g *FamilyGenerator) Generate(obj interface{}) *metric.Family

Generate calls the FamilyGenerator.GenerateFunc and gives the family its name. The reasoning behind injecting the name at such a late point in time is deduplication in the code, preventing typos made by developers as well as saving memory.

Jump to

Keyboard shortcuts

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