Skip to content
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

Logging Cleanup - Part 1 #410

Merged
merged 1 commit into from
Sep 26, 2023
Merged

Logging Cleanup - Part 1 #410

merged 1 commit into from
Sep 26, 2023

Conversation

xWink
Copy link
Member

@xWink xWink commented Sep 24, 2023

What type of PR is this?

cleanup

Which issue does this PR fix:
#126 partially

What does this PR do / Why do we need it:

  • Removes use of glog in event handlers, listener and rule manager, and listener synthesizer
  • Removes unnecessary logs, such as in the case of log n throw
  • Cleans output of logs so that they contain less clutter, are grammatically correct, and specify more useful information
  • General code cleanliness
  • Re-adds e2e-test and e2e-clean to make help output, which appear to have been inadvertently removed?

If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:

Testing done on this change:

------------------------------

Ran 32 of 32 Specs in 2139.930 seconds
SUCCESS! -- 32 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestIntegration (2140.87s)
PASS
ok      github.com/aws/aws-application-networking-k8s/test/suites/integration   2141.628s

Automation added to e2e:

Will this PR introduce any new dependencies?:

No

Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No

Does this PR introduce any user-facing change?:

No, only logging changes


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…stener synthesizer. Added e2e-test and e2e-clean to make help output.
@coveralls
Copy link

coveralls commented Sep 24, 2023

Pull Request Test Coverage Report for Build 6288346348

  • 149 of 201 (74.13%) changed or added relevant lines in 9 files are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.6%) to 38.789%

Changes Missing Coverage Covered Lines Changed/Added Lines %
controllers/gateway_controller.go 0 1 0.0%
pkg/deploy/lattice/rule_synthesizer.go 2 3 66.67%
pkg/deploy/stack_deployer.go 3 6 50.0%
pkg/deploy/lattice/listener_manager.go 30 34 88.24%
controllers/eventhandlers/gateway.go 0 9 0.0%
controllers/eventhandlers/gatewayclass.go 0 11 0.0%
pkg/deploy/lattice/listener_synthesizer.go 17 28 60.71%
pkg/deploy/lattice/rule_manager.go 85 97 87.63%
Files with Coverage Reduction New Missed Lines %
pkg/deploy/lattice/listener_synthesizer.go 1 77.22%
pkg/deploy/lattice/rule_manager.go 5 88.92%
Totals Coverage Status
Change from base Build 6267619933: -0.6%
Covered Lines: 3977
Relevant Lines: 10253

💛 - Coveralls

@@ -99,53 +109,46 @@ func (d *defaultListenerManager) Create(ctx context.Context, listener *latticemo
}

resp, err := d.cloud.Lattice().CreateListener(&listenerInput)
if err != nil {
d.log.Errorf("Error during creation of Listener %s-%s", listenerSpec.Name, listenerSpec.Namespace)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would return error here

Copy link
Member Author

Choose a reason for hiding this comment

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

Would like to avoid behavioural changes in this PR, just improving logging/readability of code.

Copy link
Contributor

Choose a reason for hiding this comment

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

in general for refactoring you are right, but in this particular example resp is used as non-nil value few lines below, it will panic on nil.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair point, fixed next PR!

}

return nil, errors.New("Listener does not exist")
return nil, errors.New("listener does not exist")
Copy link
Contributor

Choose a reason for hiding this comment

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

good to have listener details in error message, unless caller of this function wrap error with these details

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed next PR!

@@ -95,19 +102,18 @@ func (l *listenerSynthesizer) getSDKListeners(ctx context.Context) ([]*latticemo
var resService []*latticemodel.Service

err := l.stack.ListResources(&resService)
glog.V(6).Infof("service: %v ignore err: %v \n", resService, err)
l.log.Debugf("Ignoring error when listing services %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

if err then log error

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do in part 2 PR, thanks for catching this!

@xWink xWink merged commit 0a3d875 into aws:main Sep 26, 2023
5 checks passed
@xWink xWink deleted the 126 branch September 26, 2023 07:31
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.

3 participants