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

lightning: improve log #54483

Merged
merged 7 commits into from
Jul 10, 2024
Merged

lightning: improve log #54483

merged 7 commits into from
Jul 10, 2024

Conversation

lance6716
Copy link
Contributor

@lance6716 lance6716 commented Jul 8, 2024

What problem does this PR solve?

Issue Number: close #46687 close #54478

Problem Summary:

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 8, 2024
Copy link

tiprow bot commented Jul 8, 2024

Hi @lance6716. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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.

Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 8, 2024
Copy link

codecov bot commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 56.0612%. Comparing base (cc616f9) to head (c7a06bf).

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     
Flag Coverage Δ
integration 22.5001% <85.7142%> (?)
unit 71.7716% <85.7142%> (-1.9973%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9656% <ø> (-2.2339%) ⬇️
parser ∅ <ø> (∅)
br 58.7366% <100.0000%> (+11.0349%) ⬆️

Signed-off-by: lance6716 <lance6716@gmail.com>
// 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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

conflicts with #54438

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 hope git can automatic merge the commit with same file diff

@@ -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"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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

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 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?

Copy link
Contributor

@D3Hunter D3Hunter Jul 9, 2024

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>
Copy link
Contributor

@D3Hunter D3Hunter left a comment

Choose a reason for hiding this comment

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

rest lgtm

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 9, 2024
@ti-chi-bot ti-chi-bot bot removed the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 9, 2024
@lance6716
Copy link
Contributor Author

/cc @Leavrth

@ti-chi-bot ti-chi-bot bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 9, 2024
@ti-chi-bot ti-chi-bot bot requested a review from Leavrth July 9, 2024 06:00
Copy link

ti-chi-bot bot commented Jul 10, 2024

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 10, 2024
Copy link

ti-chi-bot bot commented Jul 10, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-09 05:02:48.548814562 +0000 UTC m=+333865.784048674: ☑️ agreed by D3Hunter.
  • 2024-07-10 02:25:33.503136126 +0000 UTC m=+410830.738370237: ☑️ agreed by Leavrth.

@ti-chi-bot ti-chi-bot bot merged commit 53dcc79 into pingcap:master Jul 10, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fast ddl logs are complete "failed to get StoreInfo from pd http api" should be WARN instead of ERROR
3 participants