Implement unary negation for native histograms

Signed-off-by: Charles Korn <charles.korn@grafana.com>
This commit is contained in:
Charles Korn 2024-09-04 16:20:47 +10:00
parent 113de6301c
commit 9852855084
No known key found for this signature in database

View File

@ -1799,6 +1799,9 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, annotations.Annotatio
for j := range mat[i].Floats {
mat[i].Floats[j].F = -mat[i].Floats[j].F
}
for j := range mat[i].Histograms {
mat[i].Histograms[j].H = mat[i].Histograms[j].H.Copy().Mul(-1)
}
}
if !ev.enableDelayedNameRemoval && mat.ContainsSameLabelset() {
ev.errorf("vector cannot contain metrics with the same labelset")