mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-24 00:32:15 +00:00
main: better error message on failing to start Prometheus
Previously, if the Prometheus port (by default, 0.0.0.0:9180) could not be opened, the following message appeared in the log about 10 seconds into the run, and Scylla crashed. ERROR 2017-01-01 19:31:04,066 [shard 0] seastar - Exiting on unhandled exception: std::system_error (error system:98, Address already in use) The puzzled user would have no idea *which* address was already in use, why, or why Scylla stopped. In this patch, before the above message we get the much more informative message: ERROR 2017-01-01 19:58:19,080 [shard 0] init - Could not start Prometheus API server on 0.0.0.0:9180: std::system_error (error system:98, Address already in use) We continue to print the original message - and exit - in this case, under the assumption that it's better not to run the database while improperly configured. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20170102121304.2060-1-nyh@scylladb.com>
This commit is contained in:
5
main.cc
5
main.cc
@@ -689,7 +689,10 @@ int main(int ac, char** av) {
|
||||
pctx.prefix = cfg->prometheus_prefix();
|
||||
prometheus_server.start().get();
|
||||
prometheus::start(prometheus_server, pctx);
|
||||
prometheus_server.listen(ipv4_addr{prom_addr.addresses[0].in.s_addr, pport}).get();
|
||||
prometheus_server.listen(ipv4_addr{prom_addr.addresses[0].in.s_addr, 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
|
||||
|
||||
Reference in New Issue
Block a user