diff --git a/edgraph/server.go b/edgraph/server.go index 6b13df9060d..0d05054c24f 100644 --- a/edgraph/server.go +++ b/edgraph/server.go @@ -565,9 +565,9 @@ func (s *Server) doQuery(ctx context.Context, req *api.Request, authorize int) ( } } - // TODO(martinmr): Include Transport as part of the latency. Need to do this separately - // since it involves modifying the API protos. - // TODO (Aman): may need to calculate processing time here!!! + // TODO(martinmr): Include Transport as part of the latency. Need to do + // this separately since it involves modifying the API protos. + l.Processing = time.Since(l.Start) - l.Parsing - l.AssignTimestamp - l.Json resp.Latency = &api.Latency{ AssignTimestampNs: uint64(l.AssignTimestamp.Nanoseconds()), ParsingNs: uint64(l.Parsing.Nanoseconds()), diff --git a/query/query.go b/query/query.go index 6d1090839cf..777e83e2416 100644 --- a/query/query.go +++ b/query/query.go @@ -2579,7 +2579,6 @@ func (req *Request) ProcessQuery(ctx context.Context) (err error) { } req.Latency.Parsing += time.Since(loopStart) - execStart := time.Now() hasExecuted := make([]bool, len(req.Subgraphs)) numQueriesDone := 0 @@ -2685,7 +2684,6 @@ func (req *Request) ProcessQuery(ctx context.Context) (err error) { return errors.Errorf("Query couldn't be executed") } } - req.Latency.Processing += time.Since(execStart) // If we had a shortestPath SG, append it to the result. if len(shortestSg) != 0 { @@ -2709,7 +2707,6 @@ func (req *Request) Process(ctx context.Context) (er ExecutionResult, err error) } er.Subgraphs = req.Subgraphs - schemaProcessingStart := time.Now() if req.GqlQuery.Schema != nil { if er.SchemaNode, err = worker.GetSchemaOverNetwork(ctx, req.GqlQuery.Schema); err != nil { return er, errors.Wrapf(err, "while fetching schema") @@ -2718,7 +2715,6 @@ func (req *Request) Process(ctx context.Context) (er ExecutionResult, err error) return er, errors.Wrapf(err, "while fetching types") } } - req.Latency.Processing += time.Since(schemaProcessingStart) return er, nil }