mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
stats: const
-ify variables and arguments
We cannot convert `DEFAULT_STATSD*` to `std::string_view`s as they're being used as default arguments and `GetArgs` expects `std::string`s
This commit is contained in:
parent
9f96723774
commit
0401c581eb
@ -61,8 +61,8 @@ bool StatsdClient::ShouldSend(float sample_rate)
|
||||
return sample_rate > std::uniform_real_distribution<float>(0.f, 1.f)(insecure_rand);
|
||||
}
|
||||
|
||||
StatsdClient::StatsdClient(const std::string& host, const std::string& nodename, uint16_t port, const std::string& ns,
|
||||
bool enabled)
|
||||
StatsdClient::StatsdClient(const std::string& host, const std::string& nodename, uint16_t port,
|
||||
const std::string& ns, bool enabled)
|
||||
: m_port{port}, m_host{host}, m_nodename{nodename}, m_ns{ns}
|
||||
{
|
||||
if (!enabled) {
|
||||
|
@ -13,22 +13,22 @@
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
static const bool DEFAULT_STATSD_ENABLE = false;
|
||||
static const uint16_t DEFAULT_STATSD_PORT = 8125;
|
||||
static const std::string DEFAULT_STATSD_HOST = "127.0.0.1";
|
||||
static const std::string DEFAULT_STATSD_HOSTNAME = "";
|
||||
static const std::string DEFAULT_STATSD_NAMESPACE = "";
|
||||
static constexpr bool DEFAULT_STATSD_ENABLE{false};
|
||||
static constexpr uint16_t DEFAULT_STATSD_PORT{8125};
|
||||
static const std::string DEFAULT_STATSD_HOST{"127.0.0.1"};
|
||||
static const std::string DEFAULT_STATSD_HOSTNAME{""};
|
||||
static const std::string DEFAULT_STATSD_NAMESPACE{""};
|
||||
|
||||
// schedule periodic measurements, in seconds: default - 1 minute, min - 5 sec, max - 1h.
|
||||
static const int DEFAULT_STATSD_PERIOD = 60;
|
||||
static const int MIN_STATSD_PERIOD = 5;
|
||||
static const int MAX_STATSD_PERIOD = 60 * 60;
|
||||
static constexpr int DEFAULT_STATSD_PERIOD{60};
|
||||
static constexpr int MIN_STATSD_PERIOD{5};
|
||||
static constexpr int MAX_STATSD_PERIOD{60*60};
|
||||
|
||||
namespace statsd {
|
||||
class StatsdClient {
|
||||
public:
|
||||
explicit StatsdClient(const std::string& host, const std::string& nodename, uint16_t port, const std::string& ns,
|
||||
bool enabled);
|
||||
explicit StatsdClient(const std::string& host, const std::string& nodename, uint16_t port,
|
||||
const std::string& ns, bool enabled);
|
||||
|
||||
public:
|
||||
bool inc(const std::string& key, float sample_rate = 1.f);
|
||||
|
Loading…
Reference in New Issue
Block a user