Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions router/core/graphql_prehandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,7 @@ func (h *PreHandler) handleOperation(req *http.Request, variablesParser *astjson
if !requestContext.operation.traceOptions.ExcludePlannerStats {
httpOperation.traceTimings.StartPlanning()
}

startPlanning := time.Now()

_, enginePlanSpan := h.tracer.Start(req.Context(), "Operation - Plan",
Expand All @@ -984,22 +985,26 @@ func (h *PreHandler) handleOperation(req *http.Request, variablesParser *astjson
err = h.planner.plan(requestContext.operation, planOptions)
if err != nil {
httpOperation.requestLogger.Debug("failed to plan operation", zap.Error(err))
rtrace.AttachErrToSpan(enginePlanSpan, err)

if !requestContext.operation.traceOptions.ExcludePlannerStats {
httpOperation.traceTimings.EndPlanning()
}

requestContext.operation.planningTime = time.Since(startPlanning)

rtrace.AttachErrToSpan(enginePlanSpan, err)
enginePlanSpan.End()

return err
}

enginePlanSpan.SetAttributes(otel.WgEnginePlanCacheHit.Bool(requestContext.operation.planCacheHit))
if !requestContext.operation.traceOptions.ExcludePlannerStats {
httpOperation.traceTimings.EndPlanning()
}

requestContext.operation.planningTime = time.Since(startPlanning)
httpOperation.traceTimings.EndPlanning()

enginePlanSpan.SetAttributes(otel.WgEnginePlanCacheHit.Bool(requestContext.operation.planCacheHit))
enginePlanSpan.End()

planningAttrs := *requestContext.telemetry.AcquireAttributes()
Expand Down
Loading