mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
parent
8462fe9fac
commit
c4b4a58e3a
|
@ -163,7 +163,7 @@ func (node *BinaryExpr) String() string {
|
||||||
|
|
||||||
matching := ""
|
matching := ""
|
||||||
vm := node.VectorMatching
|
vm := node.VectorMatching
|
||||||
if vm != nil && len(vm.MatchingLabels) > 0 {
|
if vm != nil && (len(vm.MatchingLabels) > 0 || vm.On) {
|
||||||
if vm.On {
|
if vm.On {
|
||||||
matching = fmt.Sprintf(" ON(%s)", vm.MatchingLabels)
|
matching = fmt.Sprintf(" ON(%s)", vm.MatchingLabels)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -59,6 +59,10 @@ func TestExprString(t *testing.T) {
|
||||||
inputs := []struct {
|
inputs := []struct {
|
||||||
in, out string
|
in, out string
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
in: `sum(task:errors:rate10s{job="s"}) BY ()`,
|
||||||
|
out: `sum(task:errors:rate10s{job="s"})`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
in: `sum(task:errors:rate10s{job="s"}) BY (code)`,
|
in: `sum(task:errors:rate10s{job="s"}) BY (code)`,
|
||||||
},
|
},
|
||||||
|
@ -77,6 +81,9 @@ func TestExprString(t *testing.T) {
|
||||||
{
|
{
|
||||||
in: `count_values("value", task:errors:rate10s{job="s"})`,
|
in: `count_values("value", task:errors:rate10s{job="s"})`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
in: `a - ON() c`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
in: `a - ON(b) c`,
|
in: `a - ON(b) c`,
|
||||||
},
|
},
|
||||||
|
@ -92,6 +99,10 @@ func TestExprString(t *testing.T) {
|
||||||
{
|
{
|
||||||
in: `a - IGNORING(b) c`,
|
in: `a - IGNORING(b) c`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
in: `a - IGNORING() c`,
|
||||||
|
out: `a - c`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
in: `up > BOOL 0`,
|
in: `up > BOOL 0`,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue