Checking in the source code:
if c.Action == LabelDrop || c.Action == LabelKeep {
if c.SourceLabels != nil ||
c.TargetLabel != DefaultRelabelConfig.TargetLabel ||
c.Modulus != DefaultRelabelConfig.Modulus ||
c.Separator != DefaultRelabelConfig.Separator ||
c.Replacement != DefaultRelabelConfig.Replacement {
return fmt.Errorf("%s action requires only 'regex', and no other fields", c.Action)
}
}
AFAICS, there's no way that labelkeep or labeldrop can be made conditional on the metric name.
I *think* it should be possible to drop a label by replacing its value with empty string, in which case:
- source_labels: [__name__]
regex: B
target_label: junk_label
replacement: ""
But you'll have to do that 147 times.
In any case, I would question:
1. Why do you want to drop the labels? Presumably these are static (otherwise you'd have an explosion in time series), in which case, the overhead is very small and you're going to save almost no storage by removing them.
2. If these labels are superfluous, why are they being generated in the first place? Can you fix the exporter?