|
|
|
|
@ -30,6 +30,10 @@ import ( |
|
|
|
|
"github.com/prometheus/prometheus/promql/parser" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// ErrDuplicateRecordingLabelSet is returned when a recording rule evaluation produces
|
|
|
|
|
// metrics with identical labelsets after applying rule labels.
|
|
|
|
|
var ErrDuplicateRecordingLabelSet = errors.New("vector contains metrics with the same labelset after applying rule labels") |
|
|
|
|
|
|
|
|
|
// A RecordingRule records its vector expression into new timeseries.
|
|
|
|
|
type RecordingRule struct { |
|
|
|
|
name string |
|
|
|
|
@ -104,7 +108,7 @@ func (rule *RecordingRule) Eval(ctx context.Context, queryOffset time.Duration, |
|
|
|
|
// Check that the rule does not produce identical metrics after applying
|
|
|
|
|
// labels.
|
|
|
|
|
if vector.ContainsSameLabelset() { |
|
|
|
|
return nil, errors.New("vector contains metrics with the same labelset after applying rule labels") |
|
|
|
|
return nil, ErrDuplicateRecordingLabelSet |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
numSeries := len(vector) |
|
|
|
|
|