mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-21 03:16:00 -08:00
Merge pull request #1560 from prometheus/fix-keep-common-printing
Fix missing printed keep_common without grouping.
This commit is contained in:
commit
78e43ff758
|
@ -143,10 +143,10 @@ func (node *AggregateExpr) String() string {
|
|||
} else {
|
||||
format = "%s BY (%s)"
|
||||
}
|
||||
if node.KeepExtraLabels {
|
||||
format += " KEEP_COMMON"
|
||||
}
|
||||
return fmt.Sprintf(format, aggrString, node.Grouping)
|
||||
aggrString = fmt.Sprintf(format, aggrString, node.Grouping)
|
||||
}
|
||||
if node.KeepExtraLabels {
|
||||
aggrString += " KEEP_COMMON"
|
||||
}
|
||||
return aggrString
|
||||
}
|
||||
|
|
|
@ -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"}) KEEP_COMMON`,
|
||||
},
|
||||
{
|
||||
in: `sum(task:errors:rate10s{job="s"}) WITHOUT (instance)`,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue