Skip to content

K8SPG-903: replace "errors" with "github.com/pkg/errors"#1436

Open
pooknull wants to merge 6 commits intomainfrom
K8SPG-903
Open

K8SPG-903: replace "errors" with "github.com/pkg/errors"#1436
pooknull wants to merge 6 commits intomainfrom
K8SPG-903

Conversation

@pooknull
Copy link
Contributor

@pooknull pooknull commented Feb 11, 2026

https://perconadev.atlassian.net/browse/K8SPG-903

DESCRIPTION

This PR improves operator logs by adding stack traces to all errors.

There are multiple ways to achieve this. For example, the Crunchy codebase already uses standard errors.WithStack(). However, in some parts of the code it is missing, which results in the operator logging errors without stack traces. To ensure stack traces using this approach, we would need to wrap every returned error with errors.WithStack(), which is easy to forget and may be missed in the future.

In our other operators, the common practice is to use the github.com/pkg/errors package, which automatically includes a stack trace when errors are created or wrapped. By replacing "errors" with "github.com/pkg/errors", we can ensure that every error contains a stack trace.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?

Copilot AI review requested due to automatic review settings February 11, 2026 13:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings February 12, 2026 09:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 63 out of 63 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings February 12, 2026 13:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 63 out of 63 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pooknull pooknull marked this pull request as ready for review February 13, 2026 10:51
Copilot AI review requested due to automatic review settings February 13, 2026 10:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 63 out of 63 changed files in this pull request and generated 2 comments.

import (
"context"
"errors"
"fmt"
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fmt package is imported but no longer used in this file after replacing fmt.Errorf with errors.Errorf. Remove the unused import.

Suggested change
"fmt"

Copilot uses AI. Check for mistakes.
@@ -6,7 +6,6 @@ package postgrescluster

import (
"context"
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fmt package is imported but no longer used in this file after replacing fmt.Errorf with errors.Errorf. Remove the unused import.

Copilot uses AI. Check for mistakes.
@JNKPercona
Copy link
Collaborator

Test Name Result Time
backup-enable-disable passed 00:07:24
builtin-extensions passed 00:05:07
custom-envs passed 00:18:26
custom-extensions passed 00:13:43
custom-tls passed 00:04:58
database-init-sql passed 00:02:28
demand-backup passed 00:23:36
finalizers passed 00:03:39
init-deploy passed 00:02:38
huge-pages passed 00:03:03
monitoring passed 00:07:05
monitoring-pmm3 passed 00:07:57
one-pod passed 00:05:39
operator-self-healing failure 01:30:21
pitr passed 00:11:18
scaling passed 00:04:55
scheduled-backup passed 00:24:12
self-healing passed 00:08:24
sidecars passed 00:02:40
standby-pgbackrest passed 00:12:38
standby-streaming passed 00:09:01
start-from-backup passed 00:10:48
tablespaces passed 00:06:47
telemetry-transfer passed 00:03:32
upgrade-consistency passed 00:06:20
upgrade-minor passed 00:06:03
users passed 00:04:27
Summary Value
Tests Run 27/27
Job Duration 02:20:10
Total Test Time 05:07:21

commit: 7d2a1d5
image: perconalab/percona-postgresql-operator:PR-1436-7d2a1d500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants