promrelabel

package
v1.34.6 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 12 Imported by: 3

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 finalizes labels according to relabel_config rules.

It renames `__address__` to `instance` and removes labels with "__" in the beginning.

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

func GetLabelByName

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

GetLabelByName returns label with the given name from labels.

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
}

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.

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