Browse Source

In case of empty query results, return an empty matrix.

pull/96/merge
Julius Volz 12 years ago
parent
commit
3880a86c9c
  1. 6
      rules/ast/ast.go

6
rules/ast/ast.go

@ -257,16 +257,18 @@ func labelsToKey(labels model.Metric) string {
func EvalVectorInstant(node VectorNode, timestamp time.Time) (vector Vector) { func EvalVectorInstant(node VectorNode, timestamp time.Time) (vector Vector) {
viewAdapter, err := viewAdapterForInstantQuery(node, timestamp) viewAdapter, err := viewAdapterForInstantQuery(node, timestamp)
if err != nil { if err != nil {
// TODO: propagate errors.
return return
} }
return node.Eval(&timestamp, viewAdapter) return node.Eval(&timestamp, viewAdapter)
} }
func EvalVectorRange(node VectorNode, start time.Time, end time.Time, interval time.Duration) (matrix Matrix, err error) { func EvalVectorRange(node VectorNode, start time.Time, end time.Time, interval time.Duration) (matrix Matrix, err error) {
// Explicitly initialize to an empty matrix since a nil Matrix encodes to
// null in JSON.
matrix = Matrix{}
viewAdapter, err := viewAdapterForRangeQuery(node, start, end, interval) viewAdapter, err := viewAdapterForRangeQuery(node, start, end, interval)
if err != nil { if err != nil {
// TODO: propagate errors.
return return
} }
// TODO implement watchdog timer for long-running queries. // TODO implement watchdog timer for long-running queries.

Loading…
Cancel
Save