-
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
Convert Loki modules to services #1804
Conversation
ARM build currently fails because of thanos-io/thanos#2268. |
Ping me for a review when everything is ready. |
Thanks Cyril! Thanos build is now fixed, but we need new Thanos in Cortex first. That’s the next step. |
Rebased on top of #1869 to get latest Thanos with 32-bit compilation fix in. |
32bit ARM build is working now! Let's focus on #1869 first though. |
With #1869 merged, I've rebased on top of Loki master. I think this is ready for review now. |
Going to need a bit of rebase, I'm starting the review. If you're busy let me know I can try to take over. |
I will try to rebase. |
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
🤣 |
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
It now starts all background tasks in Starting state. Stopping needs little work, as does reacting on lifecycler errors. Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
It now doesn't call os.Exit, but shuts down gracefully and enters Failed state. That triggers Loki to shutdown completely. Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
This is a signal that Loki should stop. Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
It checks the state of all services, and asks ingester for its own check as well. Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Rebased, with tests passing. |
Codecov Report
@@ Coverage Diff @@
## master #1804 +/- ##
==========================================
- Coverage 64.69% 64.37% -0.33%
==========================================
Files 125 131 +6
Lines 9539 9995 +456
==========================================
+ Hits 6171 6434 +263
- Misses 2941 3081 +140
- Partials 427 480 +53
|
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
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.
LGTM
cortexproject/cortex#2166, but for logs.
This PR converts loki modules to act as "services", which are objects with operational state with methods to start/stop the service, observable state and listening methods for state transitions. Please check Cortex PR 2166 for details and proposal document.
What it means for Loki:
newModuleServiceWrapper
function, which adds waiting for dependencies: eg.Ingester
doesn't fully start until all its dependencies are started.Ring
doesn't stop until all services using it stop first.Server
service waits until all other services stop, before stoppingFailed
state on failures. Components using a Lifecycler must react on it (typically by enteringFailed
state on their own)/ready
handler, which reports 200 only if all services are inRunning
state. If any service is starting, stopping, terminated or failed, it returns 503 (StatusServiceUnavailable
) state.Starting
states. This is useful for replaying WALs or fetching extra data to handle queries (TSDB index headers in Cortex)Special notes for your reviewer: Please familiarize yourself with Service interface and perhaps BasicService implementation.
Checklist