Documentation ¶
Index ¶
- func ComposeMetricGenFuncs(familyGens []FamilyGenerator) func(obj interface{}) []metric.FamilyInterface
- func ExtractMetricFamilyHeaders(families []FamilyGenerator) []string
- type CompositeFamilyGeneratorFilter
- type FamilyGenerator
- func FilterFamilyGenerators(filter FamilyGeneratorFilter, families []FamilyGenerator) []FamilyGenerator
- func NewFamilyGeneratorWithStability(name string, help string, metricType metric.Type, ...) *FamilyGenerator
- func NewOptInFamilyGenerator(name string, help string, metricType metric.Type, ...) *FamilyGenerator
- type FamilyGeneratorFilter
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 CompositeFamilyGeneratorFilter ¶ added in v2.3.0
type CompositeFamilyGeneratorFilter struct {
// contains filtered or unexported fields
}
CompositeFamilyGeneratorFilter is composite for combining multiple filters
func NewCompositeFamilyGeneratorFilter ¶ added in v2.3.0
func NewCompositeFamilyGeneratorFilter(filters ...FamilyGeneratorFilter) CompositeFamilyGeneratorFilter
NewCompositeFamilyGeneratorFilter combines multiple family generators filters into one composite filter
func (CompositeFamilyGeneratorFilter) Test ¶ added in v2.3.0
func (composite CompositeFamilyGeneratorFilter) Test(generator FamilyGenerator) bool
Test tests the generator by passing it through the filters contained within the composite and return false if the generator does not match all the filters
type FamilyGenerator ¶
type FamilyGenerator struct { GenerateFunc func(obj interface{}) *metric.Family Name string Help string Type metric.Type DeprecatedVersion string StabilityLevel basemetrics.StabilityLevel OptIn bool }
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 FilterFamilyGenerators ¶ added in v2.3.0
func FilterFamilyGenerators(filter FamilyGeneratorFilter, families []FamilyGenerator) []FamilyGenerator
FilterFamilyGenerators filters a given slice of family generators based upon a given filter and returns a slice containing the family generators which passed the filter criteria
func NewFamilyGeneratorWithStability ¶ added in v2.7.0
func NewFamilyGeneratorWithStability(name string, help string, metricType metric.Type, stabilityLevel basemetrics.StabilityLevel, deprecatedVersion string, generateFunc func(obj interface{}) *metric.Family) *FamilyGenerator
NewFamilyGeneratorWithStability creates new FamilyGenerator instances with metric stabilityLevel.
func NewOptInFamilyGenerator ¶ added in v2.3.0
func NewOptInFamilyGenerator(name string, help string, metricType metric.Type, stabilityLevel basemetrics.StabilityLevel, deprecatedVersion string, generateFunc func(obj interface{}) *metric.Family) *FamilyGenerator
NewOptInFamilyGenerator creates new FamilyGenerator instances for opt-in metric families.
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.
type FamilyGeneratorFilter ¶ added in v2.3.0
type FamilyGeneratorFilter interface { // Test returns true if it passes the criteria of the filter, otherwise it // will return false and the metric family is not exposed by the store Test(generator FamilyGenerator) bool }
FamilyGeneratorFilter represents a filter which decides whether a metric family is exposed by the store or not