promrelabel

package
v1.37.3 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyRelabelConfigs

func ApplyRelabelConfigs(labels []prompbmarshal.Label, labelsOffset int, prcs []ParsedRelabelConfig, isFinalize bool) []prompbmarshal.Label

ApplyRelabelConfigs applies prcs to labels starting from the labelsOffset.

If isFinalize is set, then FinalizeLabels is called on the labels[labelsOffset:].

The returned labels at labels[labelsOffset:] are sorted.

func FinalizeLabels

func FinalizeLabels(dst, src []prompbmarshal.Label) []prompbmarshal.Label

FinalizeLabels removes labels with "__" in the beginning (except of "__name__").

func GetLabelByName

func GetLabelByName(labels []prompbmarshal.Label, name string) *prompbmarshal.Label

GetLabelByName returns label with the given name from labels.

func GetLabelValueByName added in v1.34.8

func GetLabelValueByName(labels []prompbmarshal.Label, name string) string

GetLabelValueByName returns value for label with the given name from labels.

It returns empty string for non-existing label.

func RemoveMetaLabels added in v1.34.8

func RemoveMetaLabels(dst, src []prompbmarshal.Label) []prompbmarshal.Label

RemoveMetaLabels removes all the `__meta_` labels from src and puts the rest of labels to dst.

See https://www.robustperception.io/life-of-a-label fo details.

func SortLabels

func SortLabels(labels []prompbmarshal.Label)

SortLabels sorts labels.

Types

type ParsedRelabelConfig

type ParsedRelabelConfig struct {
	SourceLabels []string
	Separator    string
	TargetLabel  string
	Regex        *regexp.Regexp
	Modulus      uint64
	Replacement  string
	Action       string
	// contains filtered or unexported fields
}

ParsedRelabelConfig contains parsed `relabel_config`.

See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config

func LoadRelabelConfigs

func LoadRelabelConfigs(path string) ([]ParsedRelabelConfig, error)

LoadRelabelConfigs loads relabel configs from the given path.

func ParseRelabelConfigs

func ParseRelabelConfigs(dst []ParsedRelabelConfig, rcs []RelabelConfig) ([]ParsedRelabelConfig, error)

ParseRelabelConfigs parses rcs to dst.

func (*ParsedRelabelConfig) String added in v1.35.1

func (prc *ParsedRelabelConfig) String() string

String returns human-readable representation for prc.

type RelabelConfig

type RelabelConfig struct {
	SourceLabels []string `yaml:"source_labels"`
	Separator    *string  `yaml:"separator"`
	TargetLabel  string   `yaml:"target_label"`
	Regex        *string  `yaml:"regex"`
	Modulus      uint64   `yaml:"modulus"`
	Replacement  *string  `yaml:"replacement"`
	Action       string   `yaml:"action"`
}

RelabelConfig represents relabel config.

See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config

Jump to

Keyboard shortcuts

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