-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Asynchronous Promtail stages #2996
Conversation
Based off @jeschkies idea. WIP Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #2996 +/- ##
==========================================
+ Coverage 62.39% 62.53% +0.13%
==========================================
Files 185 185
Lines 15626 15731 +105
==========================================
+ Hits 9750 9837 +87
- Misses 4949 4975 +26
+ Partials 927 919 -8
|
Signed-off-by: Cyril Tovena <cyril.tovena@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.
Thanks for this great effort.
Did you mean The old interface was sync:
instead of The old interface was async:
in the PR message?
Co-authored-by: Karsten Jeschkies <k@jeschkies.xyz>
Yep sorry :) |
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 gave it a quick review but spent some extra time in the api
and stage
packages. I like this new approach and think it looks good. I'm curious to see how well the runtime handles the new work (more goroutines, etc) but I expect it'll be much better.
That being said, I don't spend a ton of time in these packages usually.
Thanks @owen-d I still need to address Karsten feedback before merging. I also want to take it for a spin in dev. |
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Everything seems to run smoothly and CPU is lower than before 👍 Getting test to pass and I'll merge this. |
This PR essentially changes promtail stages interface to uses channel, the idea is from @jeschkies based on https://blog.golang.org/pipelines .
The old interface was synchronous:
Which means it was difficult to buffer/skip/duplicate entries before passing them down to another stages. For instance we were using a drop label that was interpreted by the pipeline to skip entries.
Now this is much simpler, the new interface uses two channels; one inbound and one outbound:
The pipeline will chain all channels together, in->out -> in -> out -> .... etc...
Unfortunately once you start going async, you have to go async bottom-up in the whole stack, this means promtail client interface has also changed from:
to
Now as you can imagine, we can wrap the Client chanel (sink) with the new pipeline to introduce mutation/buffering/deletion and so on before sending them.
This means we will be able to move forward with #74 much more easily without hacking around the synchronous limitation, @jeschkies has a PR already in good shape that will be following.
Special notes for your reviewer:
Lot of channel and goroutine usage !
All tests are still the same, this is a Noop from the user point of view, I've backported all stages.
Checklist