Skip to content

Conversation

@phuhung273
Copy link
Contributor

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
Remove unneeded logging right before returning error.

How I decide which logging is useful:

Would be great if you can feedback if my decision is reasonable. Thanks team.

Which issue(s) this PR fixes:
Fixes #334

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Sep 7, 2025
@netlify
Copy link

netlify bot commented Sep 7, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 0b67e91
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/68c4ec93b4db0e00083119d5
😎 Deploy Preview https://deploy-preview-1544--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 7, 2025
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 7, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @phuhung273!

It looks like this is your first PR to kubernetes-sigs/gateway-api-inference-extension 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/gateway-api-inference-extension has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @phuhung273. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 7, 2025
@kfswain
Copy link
Collaborator

kfswain commented Sep 10, 2025

I'm a little torn, I think the setupLog errors we may want to keep, but the others are probably okay to remove?

@phuhung273 phuhung273 force-pushed the remove-logging-before-err branch from bc00e9f to c6c06b8 Compare September 11, 2025 00:04
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 11, 2025
@phuhung273
Copy link
Contributor Author

Thanks @kfswain for your advice 👍 setupLog is restored. I'm new to the codebase so don't have much context.

@nirrozenbaum
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 11, 2025
Copy link
Contributor

@nirrozenbaum nirrozenbaum left a comment

Choose a reason for hiding this comment

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

@phuhung273 thanks for your PR.
I left comments in few places. I think we should address those (I left only in few examples, I assume you will find the other places).

basically the main point is to keep the original error msg and wrap the errors (wrap errors is the best practice for error handling).

if err != nil {
log.Error(err, "gRPC server failed to listen")
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

it's ok to remove the log.Error here, but can we wrap err so that the original err test is kept?

Suggested change
log.Error(err, "gRPC server failed to listen")
return err
return fmt.Errorf("gRPC server failed to listen - %w", err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your instruction 👍 I couldnt commit your suggestion because GH doesn't support committing suggestion on deleted lines yet. Could you have a look on the manual changes.

Comment on lines 62 to 61
if err := srv.Serve(lis); err != nil && err != grpc.ErrServerStopped {
log.Error(err, "gRPC server failed")
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto:

Suggested change
log.Error(err, "gRPC server failed")
return err
return fmt.Errof("gRPC server failed - %w", err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated according to your suggestion

if err != nil {
logger.Error(err, "Failed to create self signed certificate")
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Suggested change
logger.Error(err, "Failed to create self signed certificate")
return err
return fmt.Errorf("Failed to create self signed certificate - %w", err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated according to your suggestion

Comment on lines 93 to 91
if err != nil {
logger.Error(err, "Failed to convert XInferencePool to InferencePool")
return ctrl.Result{}, err
Copy link
Contributor

Choose a reason for hiding this comment

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

these seem like useful error messages when trying to debug:

Suggested change
logger.Error(err, "Failed to convert XInferencePool to InferencePool")
return ctrl.Result{}, err
return ctrl.Result{}, fmt.Errorf("Failed to convert XInferencePool to InferencePool - %w", err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated according to your suggestion

@phuhung273 phuhung273 force-pushed the remove-logging-before-err branch from c6c06b8 to 4dd2dcf Compare September 11, 2025 11:47
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 11, 2025
}
if err := srv.Send(resp); err != nil {
logger.V(logutil.DEFAULT).Error(err, "Send failed")
return status.Errorf(codes.Unknown, "failed to send response back to Envoy: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

is this error logged in the pod?
(I think not, so we might need log line back in the server.go both under epp and bbr)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I really have no idea 😅 Maybe we can keep everything in server.go and remove only this part which the team is already complaining

// This error occurs very frequently, though it doesn't seem to have any impact.
// TODO Figure out if we can remove this noise.
loggerVerbose.Error(recvErr, "Cannot receive stream request")

@phuhung273 phuhung273 force-pushed the remove-logging-before-err branch from 4dd2dcf to 0b67e91 Compare September 13, 2025 04:01
Copy link
Contributor

@nirrozenbaum nirrozenbaum left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 13, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nirrozenbaum, phuhung273

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2025
@k8s-ci-robot k8s-ci-robot merged commit dcfa5fe into kubernetes-sigs:main Sep 13, 2025
9 checks passed
@phuhung273 phuhung273 deleted the remove-logging-before-err branch September 14, 2025 01:24
BenjaminBraunDev pushed a commit to BenjaminBraunDev/gateway-api-inference-extension that referenced this pull request Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove logging calls from library code

4 participants