@@ -229,16 +229,18 @@ func (mr *dgraphResolver) rewriteAndExecute(
229
229
}
230
230
}()
231
231
232
+ dgraphPreMutationQueryDuration := & schema.LabeledOffsetDuration {Label : "preMutationQuery" }
232
233
dgraphMutationDuration := & schema.LabeledOffsetDuration {Label : "mutation" }
233
- dgraphQueryDuration := & schema.LabeledOffsetDuration {Label : "query" }
234
+ dgraphPostMutationQueryDuration := & schema.LabeledOffsetDuration {Label : "query" }
234
235
ext := & schema.Extensions {
235
236
Tracing : & schema.Trace {
236
237
Execution : & schema.ExecutionTrace {
237
238
Resolvers : []* schema.ResolverTrace {
238
239
{
239
240
Dgraph : []* schema.LabeledOffsetDuration {
241
+ dgraphPreMutationQueryDuration ,
240
242
dgraphMutationDuration ,
241
- dgraphQueryDuration ,
243
+ dgraphPostMutationQueryDuration ,
242
244
},
243
245
},
244
246
},
@@ -275,12 +277,17 @@ func (mr *dgraphResolver) rewriteAndExecute(
275
277
// Don't execute the query in those cases.
276
278
// The query will also be empty in case this is not an Add or an Update Mutation.
277
279
if req .Query != "" {
280
+ // Executing and processing existence queries
281
+ queryTimer := newtimer (ctx , & dgraphPreMutationQueryDuration .OffsetDuration )
282
+ queryTimer .Start ()
278
283
mutResp , err = mr .executor .Execute (ctx , req )
279
- }
280
- if err != nil {
281
- gqlErr := schema .GQLWrapLocationf (
282
- err , mutation .Location (), "mutation %s failed" , mutation .Name ())
283
- return emptyResult (gqlErr ), resolverFailed
284
+ queryTimer .Stop ()
285
+ if err != nil {
286
+ gqlErr := schema .GQLWrapLocationf (
287
+ err , mutation .Location (), "mutation %s failed" , mutation .Name ())
288
+ return emptyResult (gqlErr ), resolverFailed
289
+ }
290
+ ext .TouchedUids += mutResp .GetMetrics ().GetNumUids ()[touchedUidsKey ]
284
291
}
285
292
286
293
// Parse the result of query.
@@ -405,7 +412,7 @@ func (mr *dgraphResolver) rewriteAndExecute(
405
412
}
406
413
commit = true
407
414
408
- queryTimer := newtimer (ctx , & dgraphQueryDuration .OffsetDuration )
415
+ queryTimer := newtimer (ctx , & dgraphPostMutationQueryDuration .OffsetDuration )
409
416
queryTimer .Start ()
410
417
qryResp , err := mr .executor .Execute (ctx , & dgoapi.Request {Query : dgraph .AsString (dgQuery ),
411
418
ReadOnly : true })
0 commit comments