-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
ddl: use package-level logger which preset "category" field #52885
Conversation
Signed-off-by: lance6716 <lance6716@gmail.com>
Hi @lance6716. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with 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/test-infra repository. |
/ok-to-test |
Signed-off-by: lance6716 <lance6716@gmail.com>
/retest |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #52885 +/- ##
=================================================
- Coverage 72.4341% 55.2474% -17.1867%
=================================================
Files 1481 1593 +112
Lines 428353 598449 +170096
=================================================
+ Hits 310274 330628 +20354
- Misses 98884 244842 +145958
- Partials 19195 22979 +3784
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
rest lgtm
pkg/ddl/ingest/env.go
Outdated
"github.com/pingcap/tidb/pkg/util/memory" | ||
"github.com/pingcap/tidb/pkg/util/size" | ||
"go.uber.org/zap" | ||
) | ||
|
||
var ( | ||
litLogger = logutil.BgLogger().With(zap.String(logutil.LogFieldCategory, "ddl-ingest")) | ||
// LitLogger is the package-level logger. | ||
LitLogger = zap.NewNop() |
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.
leave previous value? so we can see logs in 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.
In addition, not using a uniform initialization log interface may miss some configurations.
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.
leave previous value? so we can see logs in test
In fact I think printing all message of passed unit test is useless, makes me hard to locate the log of failed tests. I'll try to initialize these logger to https://pkg.go.dev/go.uber.org/zap/zaptest#NewLogger
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.
leave previous value? so we can see logs in test
In fact I think printing all message of passed unit test is useless, makes me hard to locate the log of failed tests. I'll try to initialize these logger to https://pkg.go.dev/go.uber.org/zap/zaptest#NewLogger
I'll revert to previous values, it's hard to write a helper function and use it once to get testing.T
for zaptest.NewLogger
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 found https://github.com/pingcap/tidb/blob/master/pkg/statistics/handle/logutil/logutil.go
Do you think this style is good? The SamplerLogger
can also replace our manually down-sample logging logic
Lines 279 to 280 in e8c397f
lastLogCount := 0 | |
lastLogTime := time.Now() |
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.
leave previous value? so we can see logs in test
In fact I think printing all message of passed unit test is useless, makes me hard to locate the log of failed tests. I'll try to initialize these logger to https://pkg.go.dev/go.uber.org/zap/zaptest#NewLogger
if the test is flaky, it might help, especially for cases that only trigger on some timeline, such as DXF
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.
zaptest.NewLogger
will print the content when test failed, or use go test -v
.
Signed-off-by: lance6716 <lance6716@gmail.com>
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Benjamin2037, D3Hunter 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 |
[LGTM Timeline notifier]Timeline:
|
/cherry-pick release-8.1 |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@lance6716: new pull request created to branch 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. |
What problem does this PR solve?
Issue Number: close #52883
Problem Summary:
What changed and how does it work?
Check List
Tests
check log
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.