- 
                Notifications
    You must be signed in to change notification settings 
- Fork 185
chore: remove unneeded logging before returning error #1544
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
chore: remove unneeded logging before returning error #1544
Conversation
| ✅ Deploy Preview for gateway-api-inference-extension ready!
 To edit notification comments on pull requests, go to your Netlify project configuration. | 
| Welcome @phuhung273!  | 
| 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  Once the patch is verified, the new status will be reflected by the  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. | 
| I'm a little torn, I think the setupLog errors we may want to keep, but the others are probably okay to remove? | 
bc00e9f    to
    c6c06b8      
    Compare
  
    | Thanks @kfswain for your advice 👍 setupLog is restored. I'm new to the codebase so don't have much context. | 
| /ok-to-test | 
There was a problem hiding this 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).
        
          
                internal/runnable/grpc.go
              
                Outdated
          
        
      | if err != nil { | ||
| log.Error(err, "gRPC server failed to listen") | ||
| return err | 
There was a problem hiding this comment.
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?
| log.Error(err, "gRPC server failed to listen") | |
| return err | |
| return fmt.Errorf("gRPC server failed to listen - %w", err) | 
There was a problem hiding this comment.
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.
        
          
                internal/runnable/grpc.go
              
                Outdated
          
        
      | if err := srv.Serve(lis); err != nil && err != grpc.ErrServerStopped { | ||
| log.Error(err, "gRPC server failed") | ||
| return err | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto:
| log.Error(err, "gRPC server failed") | |
| return err | |
| return fmt.Errof("gRPC server failed - %w", err) | 
There was a problem hiding this comment.
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
        
          
                pkg/bbr/server/runserver.go
              
                Outdated
          
        
      | if err != nil { | ||
| logger.Error(err, "Failed to create self signed certificate") | ||
| return err | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
| logger.Error(err, "Failed to create self signed certificate") | |
| return err | |
| return fmt.Errorf("Failed to create self signed certificate - %w", err) | 
There was a problem hiding this comment.
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 convert XInferencePool to InferencePool") | ||
| return ctrl.Result{}, err | 
There was a problem hiding this comment.
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:
| 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) | 
There was a problem hiding this comment.
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
c6c06b8    to
    4dd2dcf      
    Compare
  
    | } | ||
| 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) | 
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 
gateway-api-inference-extension/pkg/bbr/handlers/server.go
Lines 64 to 66 in d03d3b6
| // 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") | 
4dd2dcf    to
    0b67e91      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
| [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  | 
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:
gateway-api-inference-extension/cmd/bbr/main.go
Lines 98 to 99 in 8b154ba
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?: