internal

package
v0.0.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchAllNames

func MatchAllNames(string) bool

func NewCollector

func NewCollector(opts *CollectorOpts) prometheus.Collector

Types

type CollectorOpts

type CollectorOpts struct {
	Cfg           *MetricConfig
	Namespace     string
	DynamicClient *dynamic.DynamicClient
	Client        *clientset.Clientset
	Log           log.Logger
}

type MatchingFn

type MatchingFn func(string) bool

func MatchRe

func MatchRe(re *regexp.Regexp) MatchingFn

type MetricConfig

type MetricConfig map[string]*ResourceSet

func (*MetricConfig) LoadFrom

func (mc *MetricConfig) LoadFrom(file string) error

type MetricSet

type MetricSet struct {
	// Flag indicating whether to group resource size by name or not.
	// When true, every resource will have its own metric with label "resource_name" set to actual name
	NameLabel *bool `yaml:"nameLabel,omitempty"`
	// Regular expression to filter resources
	IncludeOnly *regexp.Regexp `yaml:"includeOnly,omitempty"`
	// Estimated size of resource serialized as JSON
	Size *bool `yaml:"size,omitempty"`
	// Number of resources in this metric set
	Count *bool `yaml:"count,omitempty"`
	// not persisted fields
	// resolved MatchingFn
	ResourceNameMatcher MatchingFn `yaml:"-"`
	// v1.APIResource associated with this metric set
	Schema *v1.APIResource `yaml:"-"`
	// schema.GroupVersion for this metric set
	GV *schema.GroupVersion `yaml:"-"`
}

func (*MetricSet) Normalize

func (ms *MetricSet) Normalize() error

Normalize provides default values for nil fields and ensures that structure is valid.

type ResourceSet

type ResourceSet struct {
	APIVersion string                `yaml:"apiVersion"`
	Kinds      map[string]*MetricSet `yaml:"kinds"`
}

Jump to

Keyboard shortcuts

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