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

Use circular buffer for zap logs #585

Merged
merged 80 commits into from
Jun 6, 2022

Conversation

fenogentov
Copy link
Contributor

@fenogentov fenogentov commented May 10, 2022

Closes #564.

@codecov
Copy link

codecov bot commented May 10, 2022

Codecov Report

Merging #585 (6275b60) into main (d03d6a0) will increase coverage by 0.14%.
The diff coverage is 100.00%.

❗ Current head 6275b60 differs from pull request most recent head 9486c10. Consider uploading reports for the commit 9486c10 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #585      +/-   ##
==========================================
+ Coverage   63.44%   63.59%   +0.14%     
==========================================
  Files         191      192       +1     
  Lines        7636     7667      +31     
==========================================
+ Hits         4845     4876      +31     
  Misses       2233     2233              
  Partials      558      558              
Impacted Files Coverage Δ
internal/util/logging/logging.go 71.42% <100.00%> (+11.42%) ⬆️
internal/util/logging/logram.go 100.00% <100.00%> (ø)
Flag Coverage Δ
FerretDB 59.17% <54.54%> (-0.04%) ⬇️
MongoDB 6.34% <54.54%> (+0.18%) ⬆️
integration 59.20% <54.54%> (-0.04%) ⬇️
unit 23.48% <100.00%> (+0.44%) ⬆️

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

@seeforschauer seeforschauer marked this pull request as ready for review May 11, 2022 15:09
Copy link
Member

@AlekSi AlekSi left a comment

Choose a reason for hiding this comment

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

We should also add a method to get stored entires back as a slice ([]zap.Entry), covering cases when ring buffer is not full yet. I.e. we should not always return 1024 slice elements with some of them being nil

internal/util/logging/logram.go Outdated Show resolved Hide resolved
@fenogentov fenogentov requested a review from AlekSi May 12, 2022 04:23
Copy link
Contributor

@seeforschauer seeforschauer left a comment

Choose a reason for hiding this comment

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

As for me, PR task was also unclear and very interesting. )
I read #420 and #564 and understood a few.
@fenogentov I would be thankful if yod' tell all the benefits of this. (i.e. why does FerretDB need this task? Wait, maybe @AlekSi can explain better, what is the issue is solved? Anyway, what is the thing with it?)

@seeforschauer
Copy link
Contributor

@fenogentov linters failing.

Copy link
Contributor

@seeforschauer seeforschauer left a comment

Choose a reason for hiding this comment

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

package description is required, unfortunately, I can't find it.
everything else LGTM.

@fenogentov
Copy link
Contributor Author

package description is required, unfortunately, I can't find it. everything else LGTM.

logging package is common, so the description of the structure explains why this functionality

internal/util/logging/logram.go Outdated Show resolved Hide resolved
Co-authored-by: Dmitry <dmitry.eremenko@ferretdb.io>
seeforschauer
seeforschauer previously approved these changes Jun 6, 2022
@AlekSi AlekSi enabled auto-merge (squash) June 6, 2022 14:56
@AlekSi AlekSi disabled auto-merge June 6, 2022 14:58
@AlekSi AlekSi merged commit f288ca8 into FerretDB:main Jun 6, 2022
@AlekSi AlekSi added the code/chore Code maintenance improvements label Jun 6, 2022
@AlekSi AlekSi added this to the v0.3.1 milestone Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/chore Code maintenance improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use circular buffer for zap logs
5 participants