mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Nonexistent labels in BY-clauses shouldn't propagate to result.
This fixes bug 2. of https://github.com/prometheus/prometheus/issues/374 Change-Id: Ia4a13153616bafce5bf10597966b071434422d09
This commit is contained in:
parent
c342ad33a0
commit
0378c2ca1f
|
@ -41,7 +41,7 @@ var (
|
|||
BucketBuilder: prometheus.AccumulatingBucketBuilder(prometheus.EvictAndReplaceWith(10, prometheus.AverageReducer), 100),
|
||||
ReportablePercentiles: []float64{0.01, 0.05, 0.5, 0.90, 0.99}})
|
||||
|
||||
targetOperations = prometheus.NewCounter()
|
||||
targetOperations = prometheus.NewCounter()
|
||||
dnsSDLookupsCount = prometheus.NewCounter()
|
||||
)
|
||||
|
||||
|
|
|
@ -398,7 +398,9 @@ func (node *VectorAggregation) Eval(timestamp clientmodel.Timestamp, view *viewA
|
|||
} else {
|
||||
m[clientmodel.MetricNameLabel] = sample.Metric[clientmodel.MetricNameLabel]
|
||||
for _, l := range node.groupBy {
|
||||
m[l] = sample.Metric[l]
|
||||
if v, ok := sample.Metric[l]; ok {
|
||||
m[l] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
result[groupingKey] = &groupedAggregation{
|
||||
|
|
|
@ -139,6 +139,15 @@ func TestExpressions(t *testing.T) {
|
|||
},
|
||||
fullRanges: 0,
|
||||
intervalRanges: 8,
|
||||
}, {
|
||||
// Non-existent labels mentioned in BY-clauses shouldn't propagate to output.
|
||||
expr: `SUM(http_requests) BY (job, nonexistent)`,
|
||||
output: []string{
|
||||
`http_requests{job="api-server"} => 1000 @[%v]`,
|
||||
`http_requests{job="app-server"} => 2600 @[%v]`,
|
||||
},
|
||||
fullRanges: 0,
|
||||
intervalRanges: 8,
|
||||
}, {
|
||||
expr: `
|
||||
// Test comment.
|
||||
|
|
Loading…
Reference in a new issue