-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create custom struct that eases json/yaml unmarshaling of complex rel…
…abel.Config struct (#4364) Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
- Loading branch information
Danny Kopping
authored
Sep 22, 2021
1 parent
8a546b3
commit a1aaec1
Showing
5 changed files
with
120 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package util | ||
|
||
// copy and modification of github.com/prometheus/prometheus/pkg/relabel/relabel.go | ||
// reason: the custom types in github.com/prometheus/prometheus/pkg/relabel/relabel.go are difficult to unmarshal | ||
type RelabelConfig struct { | ||
// A list of labels from which values are taken and concatenated | ||
// with the configured separator in order. | ||
SourceLabels []string `yaml:"source_labels,flow,omitempty" json:"source_labels,omitempty"` | ||
// Separator is the string between concatenated values from the source labels. | ||
Separator string `yaml:"separator,omitempty" json:"separator,omitempty"` | ||
// Regex against which the concatenation is matched. | ||
Regex string `yaml:"regex,omitempty" json:"regex,omitempty"` | ||
// Modulus to take of the hash of concatenated values from the source labels. | ||
Modulus uint64 `yaml:"modulus,omitempty" json:"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" json:"target_label,omitempty"` | ||
// Replacement is the regex replacement pattern to be used. | ||
Replacement string `yaml:"replacement,omitempty" json:"replacement,omitempty"` | ||
// Action is the action to be performed for the relabeling. | ||
Action string `yaml:"action,omitempty" json:"action,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters