Skip to content

feat: robust logging #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 5, 2025
Merged

feat: robust logging #289

merged 8 commits into from
Aug 5, 2025

Conversation

vertex451
Copy link
Member

@vertex451 vertex451 commented Jul 29, 2025

The purpose of this PR - making logging more robust.

Changes

  1. Eliminated if receiver.log != nil { receiver.log(error)}. This caused the biggest changes, because we had places where logger is not passed from top level.
  2. Moved logger from method params to the receiver field.(mostly affected metadata_injector.go)

Testing

  1. Tested in local setup by creating an account.
  2. Tested local run with task listener/gateway and queried ConfigMaps from virtual workspace.

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>

fixed linter

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>

fixed linter

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>

fixed tests

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>

passing logger as a receiver field

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>

removed not used code

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>

fixed integration

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>

fixed test

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>

added test files to testingore

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>

fix(deps): update module github.com/golang-jwt/jwt/v5 to v5.3.0 (#291)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>

fix task cover

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>
@vertex451 vertex451 self-assigned this Jul 30, 2025
@vertex451 vertex451 added this to the 2025.Q3 milestone Jul 30, 2025
@vertex451 vertex451 marked this pull request as ready for review July 30, 2025 16:16
@vertex451 vertex451 requested a review from a team as a code owner July 30, 2025 16:16
@vertex451 vertex451 requested a review from pteich July 30, 2025 16:45
Copy link

@pteich pteich left a comment

Choose a reason for hiding this comment

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

I left some suggestions and questions.

Not related to this PR and maybe an oversight of a previous on: Why do we have a pkg sub-package under listener? It feels misplaced, maybe just move the two included packages out of it and align with gateway.
The original idea behind pkg is to have a common place in your repo for packages that could also used externally (in contrast to the internal folder) but it's fully optional.

@@ -298,6 +300,9 @@ func TestResolveSchema(t *testing.T) {

for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
log, err := logger.New(logger.DefaultConfig())
Copy link

Choose a reason for hiding this comment

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

i already mentioned the github.com/openmfp/golang-commons/logger/testlogger package with a compatible logger just for tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -90,13 +87,15 @@ func CheckClusterAccessCRDStatus(ctx context.Context, k8sClient client.Client, l

// ClusterAccessReconciler handles reconciliation for ClusterAccess resources
type ClusterAccessReconciler struct {
lifecycleManager *lifecycle.LifecycleManager
opts reconciler.ReconcilerOpts
client.Client
Copy link

Choose a reason for hiding this comment

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

Why embed the client and not use a struct var like in APIBindingReconciler?

Copy link
Member Author

Choose a reason for hiding this comment

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

It turned out that this field is not used.
Removed.

…into feat/logging

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>
On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>
On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>
On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>
On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>
@vertex451 vertex451 requested a review from pteich August 5, 2025 08:45
@vertex451 vertex451 merged commit eb5d8eb into main Aug 5, 2025
12 checks passed
@vertex451 vertex451 deleted the feat/logging branch August 5, 2025 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants