filesaver
filesaver::statsd::StatsdClient Class Reference

#include <StatsdClient.h>

Public Member Functions

Constructor and destructor
 StatsdClient (const std::string &host, const uint16_t port, const std::string &prefix, const std::optional< uint64_t > batchSize=std::nullopt) noexcept
 Constructor. More...
 
Methods
void setConfig (const std::string &host, const uint16_t port, const std::string &prefix) noexcept
 Sets a configuration { host, port, prefix }. More...
 
std::optional< std::string > errorMessage () const noexcept
 Returns the error message as an optional std::string. More...
 
void increment (const std::string &key, const float frequency=1.0f) const noexcept
 Increments the key, at a given frequency rate. More...
 
void decrement (const std::string &key, const float frequency=1.0f) const noexcept
 Increments the key, at a given frequency rate. More...
 
void count (const std::string &key, const int delta, const float frequency=1.0f) const noexcept
 Adjusts the specified key by a given delta, at a given frequency rate. More...
 
void gauge (const std::string &key, const unsigned int value, const float frequency=1.0f) const noexcept
 Records a gauge for the key, with a given value, at a given frequency rate. More...
 
void timing (const std::string &key, const unsigned int ms, const float frequency=1.0f) const noexcept
 Records a timing for a key, at a given frequency. More...
 
void send (const std::string &key, const int value, const std::string &type, const float frequency=1.0f) const noexcept
 Send a value for a key, according to its type, at a given frequency. More...
 

Detailed Description

Statsd client

This is the Statsd client, exposing the classic methods and relying on a UDP sender for the actual sending.

The sampling frequency can be input, as well as the batching size. The latter is optional and shall not be set if batching is not desired.

Definition at line 42 of file StatsdClient.h.

Constructor & Destructor Documentation

◆ StatsdClient()

filesaver::statsd::StatsdClient::StatsdClient ( const std::string &  host,
const uint16_t  port,
const std::string &  prefix,
const std::optional< uint64_t >  batchSize = std::nullopt 
)
noexcept

Constructor.

Definition at line 25 of file StatsdClient.cpp.

Member Function Documentation

◆ count()

void filesaver::statsd::StatsdClient::count ( const std::string &  key,
const int  delta,
const float  frequency = 1.0f 
) const
noexcept

Adjusts the specified key by a given delta, at a given frequency rate.

Definition at line 56 of file StatsdClient.cpp.

◆ decrement()

void filesaver::statsd::StatsdClient::decrement ( const std::string &  key,
const float  frequency = 1.0f 
) const
noexcept

Increments the key, at a given frequency rate.

Definition at line 46 of file StatsdClient.cpp.

◆ errorMessage()

std::optional< std::string > filesaver::statsd::StatsdClient::errorMessage ( ) const
noexcept

Returns the error message as an optional std::string.

Definition at line 41 of file StatsdClient.cpp.

◆ gauge()

void filesaver::statsd::StatsdClient::gauge ( const std::string &  key,
const unsigned int  value,
const float  frequency = 1.0f 
) const
noexcept

Records a gauge for the key, with a given value, at a given frequency rate.

Definition at line 61 of file StatsdClient.cpp.

◆ increment()

void filesaver::statsd::StatsdClient::increment ( const std::string &  key,
const float  frequency = 1.0f 
) const
noexcept

Increments the key, at a given frequency rate.

Definition at line 51 of file StatsdClient.cpp.

◆ send()

void filesaver::statsd::StatsdClient::send ( const std::string &  key,
const int  value,
const std::string &  type,
const float  frequency = 1.0f 
) const
noexcept

Send a value for a key, according to its type, at a given frequency.

Definition at line 71 of file StatsdClient.cpp.

◆ setConfig()

void filesaver::statsd::StatsdClient::setConfig ( const std::string &  host,
const uint16_t  port,
const std::string &  prefix 
)
noexcept

Sets a configuration { host, port, prefix }.

Definition at line 35 of file StatsdClient.cpp.

◆ timing()

void filesaver::statsd::StatsdClient::timing ( const std::string &  key,
const unsigned int  ms,
const float  frequency = 1.0f 
) const
noexcept

Records a timing for a key, at a given frequency.

Definition at line 66 of file StatsdClient.cpp.


The documentation for this class was generated from the following files: