@@ -81,7 +81,6 @@ func (ap *agentPoolInstance) pendingWorkspaceRuns(ctx context.Context) (int32, e
8181 }
8282 planOnlyRunCount := 0
8383 for {
84- ap .log .Info ("Fetching runs for organization" , "org" , ap .instance .Spec .Organization , "page" , listOpts .PageNumber )
8584 runsList , err := ap .tfClient .Client .Runs .ListForOrganization (ctx , ap .instance .Spec .Organization , listOpts )
8685 if err != nil {
8786 return 0 , err
@@ -108,9 +107,9 @@ func (ap *agentPoolInstance) pendingWorkspaceRuns(ctx context.Context) (int32, e
108107
109108 // TODO:
110109 // Add metric(s) for runs awaiting user interaction
111- agentsCount := len (runs ) + planOnlyRunCount
112- ap .log .Info ("Workspaces and plan-only runs count " , "msg" , fmt .Sprintf ("Workspaces: %+v Plan-only runs: %d Total agents : %d" , runs , planOnlyRunCount , agentsCount ))
113- return int32 (agentsCount ), nil
110+ totalPendingRuns := len (runs ) + planOnlyRunCount
111+ ap .log .Info ("Runs " , "msg" , fmt .Sprintf ("Workspaces: %+v Plan-only runs: %d Total pending runs : %d" , runs , planOnlyRunCount , totalPendingRuns ))
112+ return int32 (totalPendingRuns ), nil
114113}
115114
116115// computeRequiredAgents is a legacy algorithm that is used to compute the number of agents needed.
@@ -278,7 +277,7 @@ func (r *AgentPoolReconciler) reconcileAgentAutoscaling(ctx context.Context, ap
278277 r .Recorder .Eventf (& ap .instance , corev1 .EventTypeWarning , "AutoscaleAgentPoolDeployment" , "Autoscaling failed: %v" , err .Error ())
279278 return err
280279 }
281- ap .log .Info ("Reconcile Agent Autoscaling" , "msg" , fmt .Sprintf ("%d workspaces have pending runs " , requiredAgents ))
280+ ap .log .Info ("Reconcile Agent Autoscaling" , "msg" , fmt .Sprintf ("%d agents are required " , requiredAgents ))
282281
283282 currentReplicas , err := r .getAgentDeploymentReplicas (ctx , ap )
284283 if err != nil {
0 commit comments