Skip to content

Commit adeb6f7

Browse files
committed
Enhance logging in reconciliation process to include number of rows returned and stale resource count during pruning
1 parent db0700f commit adeb6f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/controller/databasequeryresource_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func (r *DatabaseQueryResourceReconciler) Reconcile(ctx context.Context, req ctr
184184
setCondition(dbqr, ConditionReconciled, metav1.ConditionFalse, "QueryFailed", fmt.Sprintf("Failed to execute query: %v", err))
185185
return ctrl.Result{RequeueAfter: pollInterval}, nil // Requeue after interval
186186
}
187-
log.Info("Query executed successfully", "columns", columnNames)
187+
log.Info("Query executed successfully", "columns", columnNames, "numRows", len(results))
188188

189189
// Process Rows and Manage Resources
190190
managedResourceKeys := make(map[string]bool) // Store keys (namespace/name) of resources created/updated in this cycle
@@ -262,7 +262,7 @@ func (r *DatabaseQueryResourceReconciler) Reconcile(ctx context.Context, req ctr
262262
if len(pruneErrors) > 0 {
263263
log.Info("Errors occurred during pruning", "error", strings.Join(pruneErrors, "; "))
264264
} else {
265-
log.Info("Pruning completed")
265+
log.Info("Pruning completed", "staleResourceCount", len(allChildResources)-len(managedResourceKeys))
266266
}
267267
} else {
268268
log.Info("Pruning disabled")

0 commit comments

Comments
 (0)