-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
lightning: improve log #54483
lightning: improve log #54483
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-sigs/prow repository. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #54483 +/- ##
=================================================
- Coverage 74.8392% 56.0612% -18.7781%
=================================================
Files 1547 1688 +141
Lines 362060 611958 +249898
=================================================
+ Hits 270963 343071 +72108
- Misses 71573 244854 +173281
- Partials 19524 24033 +4509
Flags with carried forward coverage won't be shown. Click here to find out more.
|
pkg/util/logutil/log.go
Outdated
// NOTE: Because we need to record the log count with the same level and message | ||
// in this specific logger, the returned factory function will only create one logger. | ||
// this logger support at most 4096 types of logs with the same level and message. | ||
func SampleLoggerFactory(tick time.Duration, first int, fields ...zap.Field) func() *zap.Logger { |
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.
conflicts with #54438
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 hope git can automatic merge the commit with same file diff
br/pkg/utils/retry.go
Outdated
@@ -246,6 +247,8 @@ func WithRetryV2[T any]( | |||
return *new(T), allErrors // nolint:wrapcheck | |||
} | |||
|
|||
var sampleLoggerFactory = logutil.SampleLoggerFactory(time.Minute, 3, zap.String(logutil.LogFieldCategory, "br-utils")) |
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.
var sampleLoggerFactory = logutil.SampleLoggerFactory(time.Minute, 3, zap.String(logutil.LogFieldCategory, "br-utils")) | |
var sampleLoggerFactory = logutil.SampleLoggerFactory(time.Minute, 3, zap.String(logutil.LogFieldCategory, "utils")) |
as lightning will depends on it indirectly, maybe not appear br
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 also want to add something to show it's a "sample logger", so when reading log we don't think the function is really executed for 1 minutes. Do you think zap.String(logutil.LogFieldCategory, "utils-sample-logger")
is good?
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.
maybe zap.String("sampled", "")
, we can add inside factory, effective to all?
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.
rest lgtm
Signed-off-by: lance6716 <lance6716@gmail.com>
/cc @Leavrth |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: D3Hunter, Leavrth 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 problem does this PR solve?
Issue Number: close #46687 close #54478
Problem Summary:
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.