mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-03 13:37:04 +00:00
main: Prometheus should start as early as possible
There is no need to wait when starting the prometheus server. As it is up to each of the modules to register its metrics when it is ready. This is especially important when debuging boot issues. This patch moves the prometheus initilization to be done at an early stage of the boot sequencec. Fixes #2144 Signed-off-by: Amnon Heiman <amnon@scylladb.com> Message-Id: <1489041986-28974-1-git-send-email-amnon@scylladb.com>
This commit is contained in:
27
main.cc
27
main.cc
@@ -358,7 +358,19 @@ int main(int ac, char** av) {
|
||||
sstring api_address = cfg->api_address() != "" ? cfg->api_address() : rpc_address;
|
||||
sstring broadcast_address = cfg->broadcast_address();
|
||||
sstring broadcast_rpc_address = cfg->broadcast_rpc_address();
|
||||
|
||||
auto prom_addr = seastar::net::dns::get_host_by_name(cfg->prometheus_address()).get0();
|
||||
supervisor::notify("starting prometheus API server");
|
||||
uint16_t pport = cfg->prometheus_port();
|
||||
if (pport) {
|
||||
pctx.metric_help = "Scylla server statistics";
|
||||
pctx.prefix = cfg->prometheus_prefix();
|
||||
prometheus_server.start().get();
|
||||
prometheus::start(prometheus_server, pctx);
|
||||
prometheus_server.listen(ipv4_addr{prom_addr.addr_list.front(), pport}).handle_exception([pport, &cfg] (auto ep) {
|
||||
startlog.error("Could not start Prometheus API server on {}:{}: {}", cfg->prometheus_address(), pport, ep);
|
||||
return make_exception_future<>(ep);
|
||||
}).get();
|
||||
}
|
||||
if (!broadcast_address.empty()) {
|
||||
try {
|
||||
utils::fb_utilities::set_broadcast_address(gms::inet_address::lookup(broadcast_address).get0());
|
||||
@@ -631,19 +643,6 @@ int main(int ac, char** av) {
|
||||
}).get();
|
||||
}
|
||||
api::set_server_done(ctx).get();
|
||||
auto prom_addr = seastar::net::dns::get_host_by_name(cfg->prometheus_address()).get0();
|
||||
supervisor::notify("starting prometheus API server");
|
||||
uint16_t pport = cfg->prometheus_port();
|
||||
if (pport) {
|
||||
pctx.metric_help = "Scylla server statistics";
|
||||
pctx.prefix = cfg->prometheus_prefix();
|
||||
prometheus_server.start().get();
|
||||
prometheus::start(prometheus_server, pctx);
|
||||
prometheus_server.listen(ipv4_addr{prom_addr.addr_list.front(), pport}).handle_exception([pport, &cfg] (auto ep) {
|
||||
startlog.error("Could not start Prometheus API server on {}:{}: {}", cfg->prometheus_address(), pport, ep);
|
||||
return make_exception_future<>(ep);
|
||||
}).get();
|
||||
}
|
||||
supervisor::notify("serving");
|
||||
// Register at_exit last, so that storage_service::drain_on_shutdown will be called first
|
||||
engine().at_exit([] {
|
||||
|
||||
Reference in New Issue
Block a user