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

Fix loki log output exiting before push is finished #3194

Merged
merged 1 commit into from Jul 13, 2023

Conversation

mstoykov
Copy link
Collaborator

After #2833 log outputs were stopped but loki didn't wait until it push was finished to signal it was done.

Which leads to the actual k6 process exiting before loki could flush its messages.

After #2833 log outputs were stopped but loki didn't wait until it push
was finished to signal it was done.

Which leads to the actual k6 process exiting before loki could flush its messages.
@mstoykov mstoykov added this to the v0.46.0 milestone Jul 13, 2023
Comment on lines +153 to +154
pushDone := make(chan struct{})
defer func() { <-pushDone }()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did use a sync.WaitGroup in thePoC, but decided there is no need to import the sync package and this code is even shorter so 🤷

Copy link
Collaborator

@codebien codebien left a comment

Choose a reason for hiding this comment

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

I know this code is complex and maybe not so easy, but it would be good to have a fixed test that fails without this patch.

Up to you if you have time for it.

@codecov-commenter
Copy link

codecov-commenter commented Jul 13, 2023

Codecov Report

Merging #3194 (11f3af5) into master (ea3a23d) will decrease coverage by 0.04%.
The diff coverage is 0.00%.

❗ Current head 11f3af5 differs from pull request most recent head 3eaf6f6. Consider uploading reports for the commit 3eaf6f6 to get more accurate results

@@            Coverage Diff             @@
##           master    #3194      +/-   ##
==========================================
- Coverage   72.88%   72.85%   -0.04%     
==========================================
  Files         256      256              
  Lines       19800    19803       +3     
==========================================
- Hits        14431    14427       -4     
- Misses       4469     4475       +6     
- Partials      900      901       +1     
Flag Coverage Δ
ubuntu 72.78% <0.00%> (-0.05%) ⬇️
windows 72.68% <0.00%> (-0.04%) ⬇️

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

Impacted Files Coverage Δ
log/loki.go 30.35% <0.00%> (-0.36%) ⬇️

... and 2 files with indirect coverage changes

@mstoykov
Copy link
Collaborator Author

a fixed test that fails without this patch.

My original code was fixing the problem in totally different place, which was going to make the test .... really hard to write. But later I found out that ... the fix both didn't work and I didn't need to make it outside as the bug was actually in loki log output to begin with.

I am going to try to figure out if this is fairly easy to fix.

@mstoykov mstoykov merged commit ac448b0 into master Jul 13, 2023
22 checks passed
@mstoykov mstoykov deleted the lokiNotBeingWaitedToFlush branch July 13, 2023 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants