@@ -719,9 +719,6 @@ func (ev *evaluator) rangeEval(f func([]Value, *EvalNodeHelper) Vector, exprs ..
719719 // Make the function call.
720720 enh .ts = ts
721721 result := f (args , enh )
722- if result .ContainsSameLabelset () {
723- panic (fmt .Errorf ("vector cannot contain metrics with the same labelset" ))
724- }
725722 enh .out = result [:0 ] // Reuse result vector.
726723 // If this could be an instant query, shortcut so as not to change sort order.
727724 if ev .endTimestamp == ev .startTimestamp {
@@ -730,6 +727,9 @@ func (ev *evaluator) rangeEval(f func([]Value, *EvalNodeHelper) Vector, exprs ..
730727 s .Point .T = ts
731728 mat [i ] = Series {Metric : s .Metric , Points : []Point {s .Point }}
732729 }
730+ if mat .ContainsSameLabelset () {
731+ ev .errorf ("vector cannot contain metrics with the same labelset" )
732+ }
733733 return mat
734734 }
735735 // Add samples in output vector to output series.
@@ -758,6 +758,9 @@ func (ev *evaluator) rangeEval(f func([]Value, *EvalNodeHelper) Vector, exprs ..
758758 for _ , ss := range seriess {
759759 mat = append (mat , ss )
760760 }
761+ if mat .ContainsSameLabelset () {
762+ ev .errorf ("vector cannot contain metrics with the same labelset" )
763+ }
761764 return mat
762765}
763766
@@ -874,9 +877,6 @@ func (ev *evaluator) eval(expr Expr) Value {
874877 enh .ts = ts
875878 // Make the function call.
876879 outVec := e .Func .Call (inArgs , e .Args , enh )
877- if outVec .ContainsSameLabelset () {
878- panic (fmt .Errorf ("vector cannot contain metrics with the same labelset" ))
879- }
880880 enh .out = outVec [:0 ]
881881 if len (outVec ) > 0 {
882882 ss .Points = append (ss .Points , Point {V : outVec [0 ].Point .V , T : ts })
@@ -888,6 +888,10 @@ func (ev *evaluator) eval(expr Expr) Value {
888888 mat = append (mat , ss )
889889 }
890890 }
891+ if mat .ContainsSameLabelset () {
892+ ev .errorf ("vector cannot contain metrics with the same labelset" )
893+ }
894+
891895 putPointSlice (points )
892896 return mat
893897
0 commit comments