mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
This allows to set config keys via flags, in additions to current env variable only configuration. Flags are autogenerated from supported env keys.
21 lines
646 B
Go
21 lines
646 B
Go
package transform
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// StripLables allows filtering out some labels from alerts
|
|
// it takes the list of label keys to ignore and alert label map
|
|
// it will return label map without labels found on the ignore list
|
|
func StripLables(ignoredLabels []string, sourceLabels map[string]string) map[string]string {
|
|
labels := map[string]string{}
|
|
for label, value := range sourceLabels {
|
|
if !stringInSlice(ignoredLabels, label) {
|
|
// strip leading and trailung space in label value
|
|
// this is to normalize values in case space is added by Alertmanager rules
|
|
labels[label] = strings.TrimSpace(value)
|
|
}
|
|
}
|
|
return labels
|
|
}
|