Reorder startup and shutdown to prevent panics. (#4321)
Reorder startup and shutdown to prevent panics. (#4321)

Start rule manager only after tsdb and config is loaded.
Stop rule manager before tsdb to avoid writing to closed storage.
Wait for any in-progress reloads to complete before shutting
down rule manager, so that rule manager doesn't get updated after
being shut down.

Remove incorrect comment around shutting down query enginge.
Log when config reload is completed.

Fixes #4133
Fixes #4262

Signed-off-by: Brian Brazil <aadf89994a343dc176a47081f0c0bbea26f0a345@robustperception.io>
prometheus/prometheus,alileza/prometheus,kangwoo/prometheus,alileza/prometheus,kangwoo/prometheus,keegancsmith/prometheus,alileza/prometheus,kangwoo/prometheus,keegancsmith/prometheus,GoogleCloudPlatform/prometheus,prometheus/prometheus,GoogleCloudPlatform/prometheus,prometheus/prometheus,keegancsmith/prometheus,GoogleCloudPlatform/prometheus,kangwoo/prometheus,keegancsmith/prometheus,Gouthamve/prometheus,Gouthamve/prometheus,keegancsmith/prometheus,prometheus/prometheus,alileza/prometheus,GoogleCloudPlatform/prometheus,GoogleCloudPlatform/prometheus,alileza/prometheus,Gouthamve/prometheus,prometheus/prometheus,Gouthamve/prometheus