mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-06 11:02:31 +00:00
Fix duplicate output vector if delayed name removal is disabled (#15975)
Fix duplicate output vector if delayed name removal is disabled This error is emitted in cleanupMetricLabels, but is skipped if enableDelayedNameRemoval is false. This makes it consistent with label_replace Signed-off-by: Joshua Hesketh <josh@nitrotech.org> --------- Signed-off-by: Joshua Hesketh <josh@nitrotech.org> Signed-off-by: Björn Rabenstein <github@rabenste.in> Co-authored-by: Björn Rabenstein <github@rabenste.in>
This commit is contained in:
parent
c9320da61e
commit
5a5fdea7ad
@ -1689,6 +1689,9 @@ func (ev *evaluator) evalLabelJoin(ctx context.Context, args parser.Expressions)
|
||||
matrix[i].DropName = el.DropName
|
||||
}
|
||||
}
|
||||
if matrix.ContainsSameLabelset() {
|
||||
ev.errorf("vector cannot contain metrics with the same labelset")
|
||||
}
|
||||
|
||||
return matrix, ws
|
||||
}
|
||||
|
5
promql/promqltest/testdata/functions.test
vendored
5
promql/promqltest/testdata/functions.test
vendored
@ -499,6 +499,8 @@ eval instant at 20s timestamp(metric)
|
||||
load 5m
|
||||
testmetric{src="a",src1="b",src2="c",dst="original-destination-value"} 0
|
||||
testmetric{src="d",src1="e",src2="f",dst="original-destination-value"} 1
|
||||
dup{label="a", this="a"} 1.0
|
||||
dup{label="b", this="a"} 1.0
|
||||
|
||||
# label_join joins all src values in order.
|
||||
eval instant at 0m label_join(testmetric, "dst", "-", "src", "src1", "src2")
|
||||
@ -530,6 +532,9 @@ eval instant at 0m label_join(testmetric1, "dst", ", ", "src", "src1", "src2")
|
||||
testmetric1{src="foo",src1="bar",src2="foobar",dst="foo, bar, foobar"} 0
|
||||
testmetric1{src="fizz",src1="buzz",src2="fizzbuzz",dst="fizz, buzz, fizzbuzz"} 1
|
||||
|
||||
eval_fail instant at 0m label_join(dup, "label", "", "this")
|
||||
expected_fail_message vector cannot contain metrics with the same labelset
|
||||
|
||||
clear
|
||||
|
||||
# Tests for vector.
|
||||
|
Loading…
x
Reference in New Issue
Block a user