mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-27 14:39:40 -08:00
Merge pull request #1066 from prometheus/fix-bool
Fix bool modifier in recording rules and printing.
This commit is contained in:
commit
6e393807c3
|
@ -146,6 +146,11 @@ func (node *AggregateExpr) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (node *BinaryExpr) String() string {
|
func (node *BinaryExpr) String() string {
|
||||||
|
returnBool := ""
|
||||||
|
if node.ReturnBool {
|
||||||
|
returnBool = " BOOL"
|
||||||
|
}
|
||||||
|
|
||||||
matching := ""
|
matching := ""
|
||||||
vm := node.VectorMatching
|
vm := node.VectorMatching
|
||||||
if vm != nil && len(vm.On) > 0 {
|
if vm != nil && len(vm.On) > 0 {
|
||||||
|
@ -157,7 +162,7 @@ func (node *BinaryExpr) String() string {
|
||||||
matching += fmt.Sprintf(" GROUP_RIGHT(%s)", vm.Include)
|
matching += fmt.Sprintf(" GROUP_RIGHT(%s)", vm.Include)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s %s%s %s", node.LHS, node.Op, matching, node.RHS)
|
return fmt.Sprintf("%s %s%s%s %s", node.LHS, node.Op, returnBool, matching, node.RHS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (node *Call) String() string {
|
func (node *Call) String() string {
|
||||||
|
|
|
@ -30,6 +30,9 @@ func TestExprString(t *testing.T) {
|
||||||
{
|
{
|
||||||
in: `sum(task:errors:rate10s{job="s"}) BY (code) KEEP_COMMON`,
|
in: `sum(task:errors:rate10s{job="s"}) BY (code) KEEP_COMMON`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
in: `up > BOOL 0`,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range inputs {
|
for _, test := range inputs {
|
||||||
|
|
Loading…
Reference in a new issue