Skip to content

Commit

Permalink
Include the total number of touched nodes in the query metrics. (#5073)
Browse files Browse the repository at this point in the history
Total is stored under a key called "_total".
  • Loading branch information
martinmr authored Apr 1, 2020
1 parent a3f9647 commit e3118ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions edgraph/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,11 @@ func processQuery(ctx context.Context, qc *queryContext) (*api.Response, error)
resp.Metrics = &api.Metrics{
NumUids: er.Metrics,
}
var total uint64
for _, num := range resp.Metrics.NumUids {
total += num
}
resp.Metrics.NumUids["_total"] = total

return resp, err
}
Expand Down
1 change: 1 addition & 0 deletions query/query4_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1545,4 +1545,5 @@ func TestNumUids(t *testing.T) {
metrics := processQueryForMetrics(t, query)
require.Equal(t, metrics.NumUids["friend"], uint64(10))
require.Equal(t, metrics.NumUids["name"], uint64(16))
require.Equal(t, metrics.NumUids["_total"], uint64(26))
}

0 comments on commit e3118ec

Please sign in to comment.