Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert Cortex components to services (grafana#2166)
* First step towards Cortex using services model. Only Server module converted. Signed-off-by: Peter Štibraný <[email protected]> * Converted runtimeconfig.Manager to service. Signed-off-by: Peter Štibraný <[email protected]> * Added /services page. Signed-off-by: Peter Štibraný <[email protected]> * Converted memberlistKV to service. Signed-off-by: Peter Štibraný <[email protected]> * Fixed runtimeconfig tests. Signed-off-by: Peter Štibraný <[email protected]> * Converted Ring to service. Signed-off-by: Peter Štibraný <[email protected]> * Log waiting for other module to initialize. Signed-off-by: Peter Štibraný <[email protected]> * Converted overrides to service. Signed-off-by: Peter Štibraný <[email protected]> * Converted client pool to a service. Signed-off-by: Peter Štibraný <[email protected]> * Convert ring lifecycler into a service. Signed-off-by: Peter Štibraný <[email protected]> * Converted HA Tracker to a service. Signed-off-by: Peter Štibraný <[email protected]> * Converted Distributor to a service. Signed-off-by: Peter Štibraný <[email protected]> * Handle nil from wrappedService call. Signed-off-by: Peter Štibraný <[email protected]> * Explain why Server uses service and not a wrappedService. Signed-off-by: Peter Štibraný <[email protected]> * Make service from Store. Signed-off-by: Peter Štibraný <[email protected]> * Convert ingester to a service. Signed-off-by: Peter Štibraný <[email protected]> * Convert querier initialization into a service. This isn't full conversion, but more work would be required to fully use services for querier. Left TODO comment instead. Signed-off-by: Peter Štibraný <[email protected]> * Listen for module failures, and log them. Also log when all services start successfully. Signed-off-by: Peter Štibraný <[email protected]> * Convert blockQueryable and UserStore into a services. UserStore now does initial sync in Starting state. blockQueryable doesn't return querier until it has finished starting. Signed-off-by: Peter Štibraný <[email protected]> * Wait a little before shutdown. Signed-off-by: Peter Štibraný <[email protected]> * Converted queryFrontend to a service. Signed-off-by: Peter Štibraný <[email protected]> * Logging Signed-off-by: Peter Štibraný <[email protected]> * Convert TableManager to service Signed-off-by: Peter Štibraný <[email protected]> * Convert Ruler to service Signed-off-by: Peter Štibraný <[email protected]> * Convert Configs to service Signed-off-by: Peter Štibraný <[email protected]> * Convert AlertManager to service. Signed-off-by: Peter Štibraný <[email protected]> * Renamed init methods back. Signed-off-by: Peter Štibraný <[email protected]> * Fixed tests. Signed-off-by: Peter Štibraný <[email protected]> * Converted Compactor to a service. Signed-off-by: Peter Štibraný <[email protected]> * Polishing, comments. Signed-off-by: Peter Štibraný <[email protected]> * Comments. Signed-off-by: Peter Štibraný <[email protected]> * Lint comments. Signed-off-by: Peter Štibraný <[email protected]> * Stop server only after all other modules have finished. Signed-off-by: Peter Štibraný <[email protected]> * Don't send more jobs to lifecycler loop, if it's not running anymore. Signed-off-by: Peter Štibraný <[email protected]> * Don't stop Server until other modules have stopped. Signed-off-by: Peter Štibraný <[email protected]> * Removed Compactor from All target. It was meant to be for testing only. Signed-off-by: Peter Štibraný <[email protected]> * Comment. Signed-off-by: Peter Štibraný <[email protected]> * More comments around startup logic. Signed-off-by: Peter Štibraný <[email protected]> * moduleServiceWrapper doesn't need full Cortex, only serviceMap Signed-off-by: Peter Štibraný <[email protected]> * Messages Signed-off-by: Peter Štibraný <[email protected]> * Fix outdated comment. Signed-off-by: Peter Štibraný <[email protected]> * Start lifecycler in starting functions. Signed-off-by: Peter Štibraný <[email protected]> * Fixed comment. Return lifecycler's failure case, if any, as error. Signed-off-by: Peter Štibraný <[email protected]> * Fix lifecycler usage. Pass independent context to lifecycler, so that it doesn't stop too early. Signed-off-by: Peter Štibraný <[email protected]> * Fix test. Signed-off-by: Peter Štibraný <[email protected]> * Removed obsolete waiting code. Only log error if it is real error. Signed-off-by: Peter Štibraný <[email protected]> * Renamed servManager to subservices. Signed-off-by: Peter Štibraný <[email protected]> * Addressing review feedback. Signed-off-by: Peter Štibraný <[email protected]> * Fix test. Signed-off-by: Peter Štibraný <[email protected]> * Fix compilation errors after rebase. Signed-off-by: Peter Štibraný <[email protected]> * Extracted code that creates server service into separate file. Signed-off-by: Peter Štibraný <[email protected]> * Added some helper methods. Signed-off-by: Peter Štibraný <[email protected]> * Use helper methods to simplify service creation. Signed-off-by: Peter Štibraný <[email protected]> * Comment. Signed-off-by: Peter Štibraný <[email protected]> * Helper functions for manager. Signed-off-by: Peter Štibraný <[email protected]> * Use helper functions. Signed-off-by: Peter Štibraný <[email protected]> * Fixes, use helper functions. Signed-off-by: Peter Štibraný <[email protected]> * Fixes, use helper functions. Signed-off-by: Peter Štibraný <[email protected]> * comment Signed-off-by: Peter Štibraný <[email protected]> * Helper function Signed-off-by: Peter Štibraný <[email protected]> * Use helper functions to reduce amount of code. Signed-off-by: Peter Štibraný <[email protected]> * Added tests for helper functions. Signed-off-by: Peter Štibraný <[email protected]> * Fixed imports Signed-off-by: Peter Štibraný <[email protected]> * Comment Signed-off-by: Peter Štibraný <[email protected]> * Simplify code. Signed-off-by: Peter Štibraný <[email protected]> * Stop and wait until stopped. Signed-off-by: Peter Štibraný <[email protected]> * Imports Signed-off-by: Peter Štibraný <[email protected]> * Manage compaction and shipper via subservices manager. Signed-off-by: Peter Štibraný <[email protected]> * Improve error message. Signed-off-by: Peter Štibraný <[email protected]> * Comment. Signed-off-by: Peter Štibraný <[email protected]> * Comment. Signed-off-by: Peter Štibraný <[email protected]> * Added unit test for Cortex initialization and module dependencies. Signed-off-by: Peter Štibraný <[email protected]> * Comments, return errors. Signed-off-by: Peter Štibraný <[email protected]> * Unified /ready handlers into one, that reflects state of all services. It also uses ingester's check (if configured) to limit rate of starting ingesters. Signed-off-by: Peter Štibraný <[email protected]> * Added //nolint:errcheck to `defer services.StopAndAwaitTerminated(...)` calls. Signed-off-by: Peter Štibraný <[email protected]> * Fix http handler logic. Also renamed it. Signed-off-by: Peter Štibraný <[email protected]> * Address review feedback. Signed-off-by: Peter Štibraný <[email protected]> * One more test... since Shutdown already stops Run, no need to call Stop(). We can use Stop in the test instead. Signed-off-by: Peter Štibraný <[email protected]> * CHANGELOG.md Signed-off-by: Peter Štibraný <[email protected]> * Fixed integration test, old versions of Cortex didn't have /ready probe. Signed-off-by: Peter Štibraný <[email protected]> * Make lint happy. Signed-off-by: Peter Štibraný <[email protected]> * Mention /ready for all services. Signed-off-by: Peter Štibraný <[email protected]> * Wrap "not running" error into promql.ErrStorage. That makes API handler to return HTTP code 500 (server error) instead of 422 (client error). Signed-off-by: Peter Štibraný <[email protected]> * Expose http port via method on HTTPService. Signed-off-by: Peter Štibraný <[email protected]> * Print number of services in each state. Signed-off-by: Peter Štibraný <[email protected]> * Fix comment and remove obsolete line. Signed-off-by: Peter Štibraný <[email protected]> * Fix compile errors after rebase. Signed-off-by: Peter Štibraný <[email protected]> * Rebased and converted data purger to a service. Signed-off-by: Peter Štibraný <[email protected]> * Pass context to the bucket client. Signed-off-by: Peter Štibraný <[email protected]>
- Loading branch information