Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DefaultRelabelConfig = Config{ Action: Replace, Separator: ";", Regex: MustNewRegexp("(.*)"), Replacement: "$1", } )
Functions ¶
func Process ¶
Process returns a relabeled version of the given label set. The relabel configurations are applied in order of input. There are circumstances where Process will modify the input label. If you want to avoid issues with the input label set being modified, at the cost of higher memory usage, you can use lbls.Copy(). If a label set is dropped, EmptyLabels and false is returned.
Types ¶
type Action ¶
type Action string
Action is the action to be performed on relabeling.
const ( // Replace performs a regex replacement. Replace Action = "replace" // Keep drops targets for which the input does not match the regex. Keep Action = "keep" // Drop drops targets for which the input does match the regex. Drop Action = "drop" // KeepEqual drops targets for which the input does not match the target. KeepEqual Action = "keepequal" // Drop drops targets for which the input does match the target. DropEqual Action = "dropequal" // HashMod sets a label to the modulus of a hash of labels. HashMod Action = "hashmod" // LabelMap copies labels to other labelnames based on a regex. LabelMap Action = "labelmap" // LabelDrop drops any label matching the regex. LabelDrop Action = "labeldrop" // LabelKeep drops any label not matching the regex. LabelKeep Action = "labelkeep" // Lowercase maps input letters to their lower case. Lowercase Action = "lowercase" // Uppercase maps input letters to their upper case. Uppercase Action = "uppercase" )
func (*Action) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Config ¶
type Config struct { // A list of labels from which values are taken and concatenated // with the configured separator in order. SourceLabels model.LabelNames `yaml:"source_labels,flow,omitempty"` // Separator is the string between concatenated values from the source labels. Separator string `yaml:"separator,omitempty"` // Regex against which the concatenation is matched. Regex Regexp `yaml:"regex,omitempty"` // Modulus to take of the hash of concatenated values from the source labels. Modulus uint64 `yaml:"modulus,omitempty"` // TargetLabel is the label to which the resulting string is written in a replacement. // Regexp interpolation is allowed for the replace action. TargetLabel string `yaml:"target_label,omitempty"` // Replacement is the regex replacement pattern to be used. Replacement string `yaml:"replacement,omitempty"` // Action is the action to be performed for the relabeling. Action Action `yaml:"action,omitempty"` }
Config is the configuration for relabeling of target label sets.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Regexp ¶
Regexp encapsulates a regexp.Regexp and makes it YAML marshalable.
func MustNewRegexp ¶
MustNewRegexp works like NewRegexp, but panics if the regular expression does not compile.
func NewRegexp ¶
NewRegexp creates a new anchored Regexp and returns an error if the passed-in regular expression does not compile.
func (Regexp) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface.
func (Regexp) String ¶ added in v0.37.0
String returns the original string used to compile the regular expression.
func (*Regexp) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.