diff --git a/edgraph/server.go b/edgraph/server.go index 3dc554c0730..0b5327c3580 100644 --- a/edgraph/server.go +++ b/edgraph/server.go @@ -984,6 +984,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 } diff --git a/query/query4_test.go b/query/query4_test.go index 52a13a5e38c..3200a7ff181 100644 --- a/query/query4_test.go +++ b/query/query4_test.go @@ -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)) }