mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-12 16:44:05 -08:00
Implement unary negation for native histograms
Signed-off-by: Charles Korn <charles.korn@grafana.com>
This commit is contained in:
parent
113de6301c
commit
9852855084
|
@ -1799,6 +1799,9 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, annotations.Annotatio
|
||||||
for j := range mat[i].Floats {
|
for j := range mat[i].Floats {
|
||||||
mat[i].Floats[j].F = -mat[i].Floats[j].F
|
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() {
|
if !ev.enableDelayedNameRemoval && mat.ContainsSameLabelset() {
|
||||||
ev.errorf("vector cannot contain metrics with the same labelset")
|
ev.errorf("vector cannot contain metrics with the same labelset")
|
||||||
|
|
Loading…
Reference in a new issue