mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-28 04:02:21 -04:00
promql: fix double quoting in invalid label name error from count_values (#16054)
promql: fix double quoting in invalid label name error from `count_values` --------- Signed-off-by: Charles Korn <charles.korn@grafana.com> Signed-off-by: Charles Korn <charleskorn@users.noreply.github.com> Co-authored-by: Björn Rabenstein <github@rabenste.in>
This commit is contained in:
parent
8c8b83ed4e
commit
8356990709
2 changed files with 5 additions and 1 deletions
|
|
@ -1604,7 +1604,7 @@ func (ev *evaluator) eval(ctx context.Context, expr parser.Expr) (parser.Value,
|
|||
if e.Op == parser.COUNT_VALUES {
|
||||
valueLabel := param.(*parser.StringLiteral)
|
||||
if !model.LabelName(valueLabel.Val).IsValid() {
|
||||
ev.errorf("invalid label name %q", valueLabel)
|
||||
ev.errorf("invalid label name %s", valueLabel)
|
||||
}
|
||||
if !e.Without {
|
||||
sortedGrouping = append(sortedGrouping, valueLabel.Val)
|
||||
|
|
|
|||
4
promql/promqltest/testdata/aggregators.test
vendored
4
promql/promqltest/testdata/aggregators.test
vendored
|
|
@ -430,6 +430,10 @@ eval instant at 1m count_values by (job, group)("job", version)
|
|||
{job="7", group="canary"} 2
|
||||
{job="{count:20, sum:10, [-2,-1):2, [-1,-0.5):1, [-0.001,0.001]:2, (0.5,1]:1, (1,2]:2}", group="canary"} 2
|
||||
|
||||
# Test an invalid label value.
|
||||
eval_fail instant at 0 count_values("a\xc5z", version)
|
||||
expected_fail_message invalid label name "a\xc5z"
|
||||
|
||||
# Tests for quantile.
|
||||
clear
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue