common

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SrcLabelPrefix = "src_"

Variables

This section is empty.

Functions

func GetKubeConfig

func GetKubeConfig(kubeConfigPath string) (*rest.Config, error)

GetKubeConfigPath creates rest.Config from the provided path for kubeconfig. If the provided path is empty, the in-cluster config is the default.

func SrcLabels

func SrcLabels(labels model.Metric) model.LabelSet

SrcLabels returns a map of labels that are not internal.

These labels are used for matching underlying metrics (e.g. alerts).

Types

type LabelsIntersectionMatcher

type LabelsIntersectionMatcher struct {
	Labels model.LabelSet
}

LabelsIntersectionMatcher implements LabelsMatcher by spefically matching the intersection between sets

func (LabelsIntersectionMatcher) Equals

func (LabelsIntersectionMatcher) Matches

type LabelsMatcher

type LabelsMatcher interface {
	Matches(labels model.LabelSet) (match bool, keys []model.LabelName)
	Equals(other LabelsMatcher) bool
}

func NewLabelsMatcher

func NewLabelsMatcher(key string, matcher ValueMatcher) LabelsMatcher

type LabelsSubsetMatcher

type LabelsSubsetMatcher struct {
	Labels model.LabelSet
}

labelsMatcher represents a matcher definition for a set of labels. It matches if all of the label matchers match the labels.

func (LabelsSubsetMatcher) Equals

func (l LabelsSubsetMatcher) Equals(other LabelsMatcher) bool

func (LabelsSubsetMatcher) Matches

func (l LabelsSubsetMatcher) Matches(labels model.LabelSet) (bool, []model.LabelName)

type Options

type Options struct {
	// Refresh interval in seconds.
	RefreshInterval int

	PromURL         string
	AlertManagerURL string

	// Path to the kube-config file.
	Kubeconfig string

	CertFile string
	CertKey  string

	TLSMinVersion   string
	TLSCipherSuites []string

	// Disable components health evaluation
	DisableComponentsHealth bool

	// Disable incident detection
	DisableIncidents bool

	// path to the components yaml file
	ComponentsPath string
}

func (*Options) Flags

func (o *Options) Flags() *pflag.FlagSet

flags returns supported cli flags for the options.

type ValueMatcher

type ValueMatcher interface {
	Matches(value string) bool
	Equals(other ValueMatcher) bool
}

ValueMatcher represents a matcher for a specific value.

Multiple implementations are provided for different types of matchers.

func NewRegexValuesMatcher

func NewRegexValuesMatcher(regexes ...*regexp.Regexp) ValueMatcher

func NewStringValuesMatcher

func NewStringValuesMatcher(keys ...string) ValueMatcher

Jump to

Keyboard shortcuts

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