diff --git a/src/stats/client.cpp b/src/stats/client.cpp index c09dbc9bdf..56522d4b66 100644 --- a/src/stats/client.cpp +++ b/src/stats/client.cpp @@ -34,12 +34,12 @@ std::unique_ptr g_stats_client; std::unique_ptr InitStatsClient(const ArgsManager& args) { auto is_enabled = args.GetBoolArg("-statsenabled", /*fDefault=*/false); - auto host = args.GetArg("-statshost", /*fDefault=*/""); + auto host = args.GetArg("-statshost", /*fDefault=*/DEFAULT_STATSD_HOST); if (is_enabled && host.empty()) { // Stats are enabled but host has not been specified, then use - // default host. This is to preserve old behavior. - host = DEFAULT_STATSD_HOST; + // default legacy host. This is to preserve old behavior. + host = "127.0.0.1"; } else if (!host.empty()) { // Host is specified but stats are not explcitly enabled. Assume // that if a host has been specified, we want stats enabled. This diff --git a/src/stats/client.h b/src/stats/client.h index 0fa8538260..6a8f2d6f9d 100644 --- a/src/stats/client.h +++ b/src/stats/client.h @@ -19,7 +19,7 @@ class RawSender; /** Default port used to connect to a Statsd server */ static constexpr uint16_t DEFAULT_STATSD_PORT{8125}; /** Default host assumed to be running a Statsd server */ -static const std::string DEFAULT_STATSD_HOST{"127.0.0.1"}; +static const std::string DEFAULT_STATSD_HOST{""}; /** Default prefix prepended to Statsd message keys */ static const std::string DEFAULT_STATSD_PREFIX{""}; /** Default suffix appended to Statsd message keys */