@@ -23,6 +23,7 @@ and understand how to run and work with Dgraph.
2323 - [ Run a mutation] ( #run-a-mutation )
2424 - [ Run a query] ( #run-a-query )
2525 - [ Commit a transaction] ( #commit-a-transaction )
26+ - [ Check request latency] ( #check-request-latency )
2627 - [ Debug mode] ( #debug-mode )
2728- [ Development] ( #development )
2829 - [ Building the source] ( #building-the-source )
@@ -234,6 +235,29 @@ try {
234235}
235236```
236237
238+ ### Check request latency
239+
240+ To see the server latency information for requests, check the
241+ ` extensions.server_latency ` field from the Response object for queries or from
242+ the Assigned object for mutations. These latencies show the amount of time the
243+ Dgraph server took to process the entire request. It does not consider the time
244+ over the network for the request to reach back to the client.
245+
246+ ``` js
247+ // queries
248+ const res = await txn .queryWithVars (query, vars);
249+ console .log (res .extensions .server_latency );
250+ // { parsing_ns: 29478,
251+ // processing_ns: 44540975,
252+ // encoding_ns: 868178 }
253+
254+ // mutations
255+ const assigned = await txn .mutate ({ setJson: p });
256+ console .log (assigned .extensions .server_latency );
257+ // { parsing_ns: 132207,
258+ // processing_ns: 84100996 }
259+ ```
260+
237261### Debug mode
238262
239263Debug mode can be used to print helpful debug messages while performing alters,
0 commit comments