diff --git a/src/statsd_client.h b/src/statsd_client.h index 7568d8cd0e..cdda53d2e2 100644 --- a/src/statsd_client.h +++ b/src/statsd_client.h @@ -26,45 +26,45 @@ 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); +public: + 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); - bool dec(const std::string& key, float sample_rate = 1.f); - bool count(const std::string& key, int64_t value, float sample_rate = 1.f); - bool gauge(const std::string& key, int64_t value, float sample_rate = 1.f); - bool gaugeDouble(const std::string& key, double value, float sample_rate = 1.f); - bool timing(const std::string& key, int64_t ms, float sample_rate = 1.f); +public: + bool inc(const std::string& key, float sample_rate = 1.f); + bool dec(const std::string& key, float sample_rate = 1.f); + bool count(const std::string& key, int64_t value, float sample_rate = 1.f); + bool gauge(const std::string& key, int64_t value, float sample_rate = 1.f); + bool gaugeDouble(const std::string& key, double value, float sample_rate = 1.f); + bool timing(const std::string& key, int64_t ms, float sample_rate = 1.f); - /* (Low Level Api) manually send a message - * type = "c", "g" or "ms" - */ - bool send(std::string key, int64_t value, const std::string& type, float sample_rate); - bool sendDouble(std::string key, double value, const std::string& type, float sample_rate); + /* (Low Level Api) manually send a message + * type = "c", "g" or "ms" + */ + bool send(std::string key, int64_t value, const std::string& type, float sample_rate); + bool sendDouble(std::string key, double value, const std::string& type, float sample_rate); - private: - /** - * (Low Level Api) manually send a message - * which might be composed of several lines. - */ - bool send(const std::string& message); +private: + /** + * (Low Level Api) manually send a message + * which might be composed of several lines. + */ + bool send(const std::string& message); - void cleanup(std::string& key); - bool ShouldSend(float sample_rate); + void cleanup(std::string& key); + bool ShouldSend(float sample_rate); - private: - mutable Mutex cs; - mutable FastRandomContext insecure_rand GUARDED_BY(cs); +private: + mutable Mutex cs; + mutable FastRandomContext insecure_rand GUARDED_BY(cs); - std::unique_ptr m_sock{nullptr}; - std::pair m_server{{}, sizeof(struct sockaddr_storage)}; + std::unique_ptr m_sock{nullptr}; + std::pair m_server{{}, sizeof(struct sockaddr_storage)}; - const uint16_t m_port; - const std::string m_host; - const std::string m_nodename; - const std::string m_ns; + const uint16_t m_port; + const std::string m_host; + const std::string m_nodename; + const std::string m_ns; }; } // namespace statsd