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

*: skip logging if logger is discardLogger #741

Merged

Conversation

ivanvc
Copy link
Member

@ivanvc ivanvc commented Apr 29, 2024

If there is no logger defined (discardLogger), skip logging altogether for highly frequent called methods (Put, Delete, CreateBucket, CreateBucketIfNotExists, DeleteBucket, Begin, Commit, Open, MoveBucket, Sync).

There's also no need to convert byte arrays into strings (etcd-io/etcd#17878). So, I simplified these log lines.

Related to #720.

@ivanvc ivanvc changed the title *: skip logging if log is discardLogger *: skip logging if logger is discardLogger Apr 29, 2024
@ivanvc ivanvc force-pushed the supress-logging-for-frequently-called-methods branch from 28221b0 to 8eaa55b Compare April 29, 2024 22:50
@tjungblu
Copy link
Contributor

/lgtm

thank you Ivan.

bucket.go Outdated Show resolved Hide resolved
bucket.go Outdated Show resolved Hide resolved
bucket.go Outdated Show resolved Hide resolved
db.go Outdated Show resolved Hide resolved
db.go Outdated Show resolved Hide resolved
tx.go Outdated Show resolved Hide resolved
tx.go Outdated Show resolved Hide resolved
tx.go Outdated Show resolved Hide resolved
tx.go Outdated Show resolved Hide resolved
tx.go Outdated Show resolved Hide resolved
If there is no logger defined (discardLogger), skip logging altogether for
highly frequent called methods (Put, Delete, CreateBucket,
CreateBucketIfNotExists, DeleteBucket, Begin, Commit, Open, MoveBucket, Sync).

Signed-off-by: Ivan Valdes <ivan@vald.es>
@ivanvc ivanvc force-pushed the supress-logging-for-frequently-called-methods branch from 8eaa55b to fbea5d6 Compare April 30, 2024 13:20
Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

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

LGTM

Thank you!

@ahrtr ahrtr merged commit 6291f7a into etcd-io:main Apr 30, 2024
16 checks passed
@fuweid
Copy link
Member

fuweid commented May 2, 2024

Thanks @ivanvc !

@ivanvc ivanvc deleted the supress-logging-for-frequently-called-methods branch May 2, 2024 20:17
@ivanvc ivanvc mentioned this pull request Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants