AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "Metric.h"
Public Member Functions | |
Metric () | |
~Metric () | |
void | Initialize (std::string const &realmName, Acore::Asio::IoContext &ioContext, std::function< void()> overallStatusLogger) |
void | LoadFromConfigs () |
void | Update () |
bool | ShouldLog (std::string const &category, int64 value) const |
template<class T > | |
void | LogValue (std::string const &category, T value, std::vector< MetricTag > tags) |
void | LogEvent (std::string const &category, std::string const &title, std::string const &description) |
void | Unload () |
bool | IsEnabled () const |
Static Public Member Functions | |
static Metric * | instance () |
Private Member Functions | |
std::iostream & | GetDataStream () |
bool | Connect () |
void | SendBatch () |
void | ScheduleSend () |
void | ScheduleOverallStatusLog () |
Static Private Member Functions | |
static std::string | FormatInfluxDBValue (bool value) |
template<class T > | |
static std::string | FormatInfluxDBValue (T value) |
static std::string | FormatInfluxDBValue (std::string const &value) |
static std::string | FormatInfluxDBValue (char const *value) |
static std::string | FormatInfluxDBValue (double value) |
static std::string | FormatInfluxDBValue (float value) |
static std::string | FormatInfluxDBValue (std::chrono::nanoseconds value) |
static std::string | FormatInfluxDBTagValue (std::string const &value) |
Private Attributes | |
std::unique_ptr< std::iostream > | _dataStream |
MPSCQueue< MetricData > | _queuedData |
std::unique_ptr< Acore::Asio::DeadlineTimer > | _batchTimer |
std::unique_ptr< Acore::Asio::DeadlineTimer > | _overallStatusTimer |
int32 | _updateInterval = 0 |
int32 | _overallStatusTimerInterval = 0 |
bool | _enabled = false |
bool | _overallStatusTimerTriggered = false |
std::string | _hostname |
std::string | _port |
std::string | _databaseName |
std::function< void()> | _overallStatusLogger |
std::string | _realmName |
std::unordered_map< std::string, int64 > | _thresholds |
Metric::Metric | ( | ) |
Metric::~Metric | ( | ) |
|
private |
References _enabled, _hostname, _port, GetDataStream(), and LOG_ERROR.
Referenced by LoadFromConfigs(), and SendBatch().
|
staticprivate |
Referenced by Initialize(), and SendBatch().
|
staticprivate |
Referenced by FormatInfluxDBValue().
|
staticprivate |
References FormatInfluxDBValue().
|
staticprivate |
|
staticprivate |
References FormatInfluxDBValue().
|
staticprivate |
References FormatInfluxDBValue().
|
staticprivate |
|
staticprivate |
|
inlineprivate |
Referenced by Connect(), ScheduleSend(), and SendBatch().
void Metric::Initialize | ( | std::string const & | realmName, |
Acore::Asio::IoContext & | ioContext, | ||
std::function< void()> | overallStatusLogger | ||
) |
References _batchTimer, _dataStream, _overallStatusLogger, _overallStatusTimer, _realmName, FormatInfluxDBTagValue(), and LoadFromConfigs().
|
static |
|
inline |
void Metric::LoadFromConfigs | ( | ) |
References _databaseName, _enabled, _hostname, _overallStatusTimerInterval, _port, _thresholds, _updateInterval, Connect(), LOG_ERROR, ScheduleOverallStatusLog(), ScheduleSend(), sConfigMgr, and Acore::Tokenize().
Referenced by Initialize().
void Metric::LogEvent | ( | std::string const & | category, |
std::string const & | title, | ||
std::string const & | description | ||
) |
References _queuedData, MetricData::Category, METRIC_DATA_EVENT, MetricData::Text, MetricData::Timestamp, MetricData::Title, and MetricData::Type.
|
inline |
References MetricData::Category, METRIC_DATA_VALUE, MetricData::Tags, MetricData::Timestamp, MetricData::Type, and MetricData::Value.
|
private |
References _enabled, _overallStatusTimer, _overallStatusTimerInterval, _overallStatusTimerTriggered, and ScheduleOverallStatusLog().
Referenced by LoadFromConfigs(), and ScheduleOverallStatusLog().
|
private |
References _batchTimer, _enabled, _queuedData, _updateInterval, GetDataStream(), and SendBatch().
Referenced by LoadFromConfigs(), and SendBatch().
|
private |
References _databaseName, _hostname, _port, _queuedData, _realmName, MetricData::Category, Connect(), FormatInfluxDBTagValue(), GetDataStream(), LOG_ERROR, METRIC_DATA_EVENT, METRIC_DATA_VALUE, ScheduleSend(), MetricData::Tags, MetricData::Text, MetricData::Timestamp, MetricData::Title, MetricData::Type, and MetricData::Value.
Referenced by ScheduleSend(), and Unload().
bool Metric::ShouldLog | ( | std::string const & | category, |
int64 | value | ||
) | const |
References _thresholds.
void Metric::Unload | ( | ) |
References _batchTimer, _enabled, _overallStatusTimer, Acore::Asio::get_io_context(), and SendBatch().
void Metric::Update | ( | ) |
References _overallStatusLogger, and _overallStatusTimerTriggered.
|
private |
Referenced by Initialize(), ScheduleSend(), and Unload().
|
private |
Referenced by LoadFromConfigs(), and SendBatch().
|
private |
Referenced by Initialize().
|
private |
Referenced by Connect(), LoadFromConfigs(), ScheduleOverallStatusLog(), ScheduleSend(), and Unload().
|
private |
Referenced by Connect(), LoadFromConfigs(), and SendBatch().
|
private |
Referenced by Initialize(), and Update().
|
private |
Referenced by Initialize(), ScheduleOverallStatusLog(), and Unload().
|
private |
Referenced by LoadFromConfigs(), and ScheduleOverallStatusLog().
|
private |
Referenced by ScheduleOverallStatusLog(), and Update().
|
private |
Referenced by Connect(), LoadFromConfigs(), and SendBatch().
|
private |
Referenced by LogEvent(), ScheduleSend(), and SendBatch().
|
private |
Referenced by Initialize(), and SendBatch().
|
private |
Referenced by LoadFromConfigs(), and ShouldLog().
|
private |
Referenced by LoadFromConfigs(), and ScheduleSend().