K8SPG-1085: Improve SmartUpdate logs - #1677
Merged
Merged
Conversation
egegunes
requested review from
gkech,
hors,
mayankshah1607,
nmarukovich,
oksana-grishchenko and
pooknull
as code owners
July 10, 2026 08:56
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves operator observability during SmartUpdate by increasing log visibility around Patroni leader changes, checkpoint behavior, and the rollout flow.
Changes:
- Promotes several Patroni action logs (
changed primary,restarted members) from debug/verbose to INFO. - Adds a
SmartUpdatelogger name to the reconcile context for clearer log attribution. - Adds additional SmartUpdate progress logs (e.g., primary identification, checkpoint outcome, rollout start).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| internal/patroni/api.go | Raises Patroni action logs to INFO (including stdout/stderr output). |
| internal/controller/postgrescluster/instance.go | Adds SmartUpdate logger scoping and more INFO logs during instance rollout/checkpoint handling. |
Comment on lines
58
to
62
| log := logging.FromContext(ctx) | ||
| log.V(1).Info("changed primary", | ||
| log.Info("changed primary", | ||
| "stdout", stdout.String(), | ||
| "stderr", stderr.String(), | ||
| ) |
Comment on lines
87
to
91
| log := logging.FromContext(ctx) | ||
| log.V(1).Info("changed primary", | ||
| log.Info("changed primary", | ||
| "stdout", stdout.String(), | ||
| "stderr", stderr.String(), | ||
| ) |
Comment on lines
118
to
122
| log := logging.FromContext(ctx) | ||
| log.V(1).Info("changed primary", | ||
| log.Info("changed primary", | ||
| "stdout", stdout.String(), | ||
| "stderr", stderr.String(), | ||
| ) |
Comment on lines
170
to
174
| log := logging.FromContext(ctx) | ||
| log.V(1).Info("restarted members", | ||
| log.Info("restarted members", | ||
| "stdout", stdout.String(), | ||
| "stderr", stderr.String(), | ||
| ) |
| r.Recorder.Eventf(cluster, corev1.EventTypeWarning, "NoCheckpoint", | ||
| "Unable to checkpoint primary before shutdown: %v", err) | ||
| } else if duration > threshold { | ||
| log.Info(fmt.Sprintf("Shutting down primary despite checkpoint taking over %v (threshold: %v)", duration, threshold)) |
Comment on lines
+858
to
860
| log.Info("attempted checkpoint", | ||
| "duration", elapsed, "stdout", stdout, "stderr", stderr) | ||
|
|
mayankshah1607
approved these changes
Jul 10, 2026
Collaborator
commit: b901274 |
hors
approved these changes
Jul 10, 2026
egegunes
marked this pull request as draft
July 10, 2026 13:16
egegunes
marked this pull request as ready for review
July 15, 2026 07:00
nmarukovich
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGE DESCRIPTION
Changed some DEBUG logs to INFO and added more visibility for the order of rollouts.
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability