Skip to content

Commit

Permalink
feat(mutation): mutation now shows changed UIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
thesophiaxu committed Mar 18, 2022
1 parent 8f0c539 commit 999d68c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions dgraph/cmd/alpha/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ func mutationHandler(w http.ResponseWriter, r *http.Request) {
resp.Latency.ParsingNs = uint64(parseEnd.Sub(parseStart).Nanoseconds())
e := query.Extensions{
Txn: resp.Txn,
Metrics: resp.Metrics,
Latency: resp.Latency,
}
sort.Strings(e.Txn.Keys)
Expand Down
5 changes: 5 additions & 0 deletions edgraph/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,11 @@ func (s *Server) doMutate(ctx context.Context, qc *queryContext, resp *api.Respo
cost := uint64(len(newUids) + len(edges))
resp.Metrics.NumUids["mutation_cost"] = cost
resp.Metrics.NumUids["_total"] = resp.Metrics.NumUids["_total"] + cost

for _, edge := range m.Edges {
uidKey := fmt.Sprintf("_u-0x%x", edge.Entity)
resp.Metrics.NumUids[uidKey] = 1
}
}
if !qc.req.CommitNow {
calculateMutationMetrics()
Expand Down

0 comments on commit 999d68c

Please sign in to comment.