common

package
v0.0.0-...-b19e04c Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileREs

func CompileREs(regexps []string) (out []*regexp.Regexp, err error)

CompileREs compiles a list of regexps, returning an error and the empty list in case one of the regexps fails.

func MergeREs

func MergeREs(regexps []*regexp.Regexp) (string, error)

MergeREs merges together a list of regexps (this will match any pattern that matches at least one of the input regexps). the good news is that '^(^value$)$' will match 'value', so we can use the output of this function and give it to the collectors of windows_exporter and node_exporter (had this property been false, it would have been difficult to merge them, given the way the regexps are processed in windows_exporter: https://github.com/prometheus-community/windows_exporter/blob/21a02c4fbec4304f883ed7957bd81045d2f0c133/collector/logical_disk.go#L153)

func ReFromPathPrefix

func ReFromPathPrefix(prefix string) (string, error)

ReFromPathPrefix returns a regular expression matching any path prefix in the input. By path-prefix, we means that the path-prefix "/mnt" will match "/mnt", "/mnt/disk" but not "/mnt-disk" Only "/" is supported (e.g. only unix).

func ReFromPrefix

func ReFromPrefix(prefix string) (string, error)

ReFromPrefix returns a regular expression matching any prefixes in the input. e.g. ReFromPrefixes("eth"}) will match eth, eth0, ...

func ReFromREs

func ReFromREs(input []string) (string, error)

ReFromREs return an RE matching any of the input REs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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