Skip to content

Commit 999d68c

Browse files
committed
feat(mutation): mutation now shows changed UIDs
1 parent 8f0c539 commit 999d68c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

dgraph/cmd/alpha/http.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ func mutationHandler(w http.ResponseWriter, r *http.Request) {
437437
resp.Latency.ParsingNs = uint64(parseEnd.Sub(parseStart).Nanoseconds())
438438
e := query.Extensions{
439439
Txn: resp.Txn,
440+
Metrics: resp.Metrics,
440441
Latency: resp.Latency,
441442
}
442443
sort.Strings(e.Txn.Keys)

edgraph/server.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,11 @@ func (s *Server) doMutate(ctx context.Context, qc *queryContext, resp *api.Respo
816816
cost := uint64(len(newUids) + len(edges))
817817
resp.Metrics.NumUids["mutation_cost"] = cost
818818
resp.Metrics.NumUids["_total"] = resp.Metrics.NumUids["_total"] + cost
819+
820+
for _, edge := range m.Edges {
821+
uidKey := fmt.Sprintf("_u-0x%x", edge.Entity)
822+
resp.Metrics.NumUids[uidKey] = 1
823+
}
819824
}
820825
if !qc.req.CommitNow {
821826
calculateMutationMetrics()

0 commit comments

Comments
 (0)