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

Clean up tchannel client/endpoint/server logs #498

Merged
merged 2 commits into from
Oct 23, 2018
Merged

Clean up tchannel client/endpoint/server logs #498

merged 2 commits into from
Oct 23, 2018

Conversation

ChuntaoLu
Copy link
Contributor

This PR cleans up tchannel client/endpoint/server logs in the following way:

  • remove redundent tchannel client/server runtime logs since errors are warpped and returned to callers where logging happens;
  • generated endpoint handler log errors with error level, everywhere else errrors are logged with warn level;

There will be a another PR that takes cares of http client/endpoint/server logs.

@coveralls
Copy link

coveralls commented Oct 23, 2018

Coverage Status

Coverage increased (+6.4%) to 68.017% when pulling c2c0ba9 on lu.log into daae8e3 on master.

if err == nil {
c.logger.Info("Finished an outgoing client TChannel request", c.logFields()...)
} else {
c.logger.Warn("Failed to send outgoing client TChannel request", zap.Error(err))
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be logger.error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is open to discussion. My reasoning is that when error happens, we will look at one error message (which is logged at endpoint handler and anywhere else is warn) and could understand what happened, if that is not sufficient we then look further for the warn logs associated with the request. Based on what I have experienced, multiple error log sites that describe the same cause create distraction and make logs less effective.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could have a zap.field GUID associated with each warn, and let the error catch that GUID which is the root cause of this Error. We could have a runbook/wiki document all the mitigation step for each GUID and handle the oncall to SRE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once we use context.logger everywhere, we will have the request uuid in the context and all the logs that associated with the request will have the same request uuid.

if err == nil {
c.endpoint.contextLogger.Info(c.ctx, "Finished an incoming server TChannel request", c.logFields()...)
} else {
c.endpoint.contextLogger.Warn(c.ctx, "Failed to serve incoming TChannel request", zap.Error(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 contextLogger.Error

@ChuntaoLu ChuntaoLu merged commit c662e77 into master Oct 23, 2018
@ChuntaoLu ChuntaoLu deleted the lu.log branch October 23, 2018 19:56
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.

4 participants