mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-06 16:14:36 +00:00
Merge pull request #15974 from jhesketh/jhesketh/utf-label-replace
Allow UTF-8 labels in label_replace
This commit is contained in:
commit
fa1bd02c99
@ -1612,7 +1612,7 @@ func (ev *evaluator) evalLabelReplace(ctx context.Context, args parser.Expressio
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Errorf("invalid regular expression in label_replace(): %s", regexStr))
|
panic(fmt.Errorf("invalid regular expression in label_replace(): %s", regexStr))
|
||||||
}
|
}
|
||||||
if !model.LabelNameRE.MatchString(dst) {
|
if !model.LabelName(dst).IsValid() {
|
||||||
panic(fmt.Errorf("invalid destination label name in label_replace(): %s", dst))
|
panic(fmt.Errorf("invalid destination label name in label_replace(): %s", dst))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
promql/promqltest/testdata/functions.test
vendored
2
promql/promqltest/testdata/functions.test
vendored
@ -466,7 +466,7 @@ eval instant at 0m label_replace(testmetric, "dst", "", "dst", ".*")
|
|||||||
eval_fail instant at 0m label_replace(testmetric, "dst", "value-$1", "src", "(.*")
|
eval_fail instant at 0m label_replace(testmetric, "dst", "value-$1", "src", "(.*")
|
||||||
|
|
||||||
# label_replace fails when the destination label name is not a valid Prometheus label name.
|
# label_replace fails when the destination label name is not a valid Prometheus label name.
|
||||||
eval_fail instant at 0m label_replace(testmetric, "invalid-label-name", "", "src", "(.*)")
|
eval_fail instant at 0m label_replace(testmetric, "\xff", "", "src", "(.*)")
|
||||||
|
|
||||||
# label_replace fails when there would be duplicated identical output label sets.
|
# label_replace fails when there would be duplicated identical output label sets.
|
||||||
eval_fail instant at 0m label_replace(testmetric, "src", "", "", "")
|
eval_fail instant at 0m label_replace(testmetric, "src", "", "", "")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user