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

Proposal: Unify Log Library for Golang Projects #24181

Merged
merged 16 commits into from
May 31, 2021

Conversation

SabaPing
Copy link
Contributor

@SabaPing SabaPing commented Apr 21, 2021

What problem does this PR solve?

Please refer to the meta issue for more information. #24190

The primary goal is to clean up the logging component. TiDB depends on two different third part log components, which are logrus and zap. This creates unnecessary complexity. In addition, there are some other logging flaws in code.

What's Changed?

Add a proposal doc for the whole task.

Release note

  • No release note

@ti-chi-bot ti-chi-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 21, 2021
@ti-srebot
Copy link
Contributor

@ti-srebot
Copy link
Contributor

Copy link
Contributor

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Thanks for the proposal. The whole idea for unifying log library is good. Comment inline for the sentence and I would like to see more on the implementation plan, i.e., more details on what to do.

docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
@ti-chi-bot
Copy link
Member

@tisonkun: /lgtm cancel is only allowed for the PR author or the reviewers in list.

In response to this:

Thanks for the proposal. The whole idea for unifying log library is good. Comment inline for the sentence and I would like to see more on the implementation plan, i.e., more details on what to do.

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 ti-community-infra/tichi repository.

docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
docs/design/2021-04-21-unify-log-library.md Outdated Show resolved Hide resolved
@ti-chi-bot
Copy link
Member

@tisonkun: /lgtm cancel is only allowed for the PR author or the reviewers in list.

In response to this:

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 ti-community-infra/tichi repository.

For historical reasons, TiDB has two third-party logging libraries, `logrus` and `pingcap/log`. `pingcap/log` is a wrapper of `zap`.

Logs of TiDB can be divided into two types, slow query logs and the other logs.
As mentioned above, these two types of logs are emitted through two different logging libraries, which results in separate configurations for the two types of logs and requires writing additional configuration conversion code.
Copy link
Member

Choose a reason for hiding this comment

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

These two logs are intentionally to have different formats. Will there be a problem when merging the two separated configuration into one?

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 added extra conversion layers. After testing and verifying, it should be fine.

SabaPing and others added 2 commits May 11, 2021 15:18
@SabaPing
Copy link
Contributor Author

Could you follow the standard format of other design docs? It will be good to make them unified! For example, https://github.com/pingcap/tidb/blob/master/docs/design/2018-07-22-enhance-propagations.md and https://github.com/pingcap/tidb/blob/master/docs/design/2020-09-30-index-usage-information.md

The rest LGTM

I've refactored doc following the standard proposal format.

Co-authored-by: tison <wander4096@gmail.com>
@tisonkun
Copy link
Contributor

/cc @breeswish @dragonly @bb7133

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • breeswish
  • wjhuang2016

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 20, 2021
@tisonkun
Copy link
Contributor

/assign @zz-jason

@tisonkun
Copy link
Contributor

/assign @bb7133

Implementation plan:

1. Unify log library for `pingcap/tidb` first. For dependent parts we write dummy code to satisfy.
2. Unify log library for `pingcap/br`, remove the dependency on `pingcap/tidb/util/logutil`, and clear dummy code of `pingcap/tidb`.
Copy link
Member

Choose a reason for hiding this comment

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

How about the eco-system tools like 'TiCDC' and 'Dumpling'?

Mainly unit testing.

## Open issues (if applicable)
## Logging code for each component
Copy link
Member

Choose a reason for hiding this comment

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

What is this sector used for?


There must be something wrong with the engineering of these codes above, and they must be changed. The cost to change them is not small.

Rationale - for long-term consideration, we should maintain code quality. The speed of output can be sacrificed in time if necessary.
Copy link
Member

Choose a reason for hiding this comment

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

The speed of output can be sacrificed in time if necessary.

I guess you're talking about the 'performance', or more precisely, 'maintainability should be with higher priority over performance when we have to consider the trade-offs'.

@bb7133
Copy link
Member

bb7133 commented May 31, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: d06fb45

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 31, 2021
@ti-chi-bot
Copy link
Member

@SabaPing: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit a14d09d into pingcap:master May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants