TrinityCore
Metric Class Reference

#include <Metric.h>

Public Member Functions

 Metric ()
 
 ~Metric ()
 
void Initialize (std::string const &realmName, Trinity::Asio::IoContext &ioContext, std::function< void()> overallStatusLogger)
 
void LoadFromConfigs ()
 
void Update ()
 
bool ShouldLog (std::string const &category, int64 value) const
 
template<class T , class... TagsList>
void LogValue (std::string category, T value, TagsList &&... tags)
 
void LogEvent (std::string category, std::string title, std::string description)
 
void Unload ()
 
bool IsEnabled () const
 

Static Public Member Functions

static Metricinstance ()
 

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, &MetricData::QueueLink_queuedData
 
std::unique_ptr< Trinity::Asio::DeadlineTimer_batchTimer
 
std::unique_ptr< Trinity::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
 

Detailed Description

Definition at line 68 of file Metric.h.

Constructor & Destructor Documentation

◆ Metric()

Metric::Metric ( )

Definition at line 309 of file Metric.cpp.

◆ ~Metric()

Metric::~Metric ( )

Definition at line 313 of file Metric.cpp.

Member Function Documentation

◆ Connect()

bool Metric::Connect ( )
private

Definition at line 37 of file Metric.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FormatInfluxDBTagValue()

std::string Metric::FormatInfluxDBTagValue ( std::string const &  value)
staticprivate

Definition at line 298 of file Metric.cpp.

+ Here is the caller graph for this function:

◆ FormatInfluxDBValue() [1/7]

std::string Metric::FormatInfluxDBValue ( bool  value)
staticprivate

Definition at line 267 of file Metric.cpp.

+ Here is the caller graph for this function:

◆ FormatInfluxDBValue() [2/7]

std::string Metric::FormatInfluxDBValue ( char const *  value)
staticprivate

Definition at line 283 of file Metric.cpp.

+ Here is the call graph for this function:

◆ FormatInfluxDBValue() [3/7]

std::string Metric::FormatInfluxDBValue ( double  value)
staticprivate

Definition at line 288 of file Metric.cpp.

◆ FormatInfluxDBValue() [4/7]

std::string Metric::FormatInfluxDBValue ( float  value)
staticprivate

Definition at line 293 of file Metric.cpp.

+ Here is the call graph for this function:

◆ FormatInfluxDBValue() [5/7]

std::string Metric::FormatInfluxDBValue ( std::chrono::nanoseconds  value)
staticprivate

Definition at line 304 of file Metric.cpp.

+ Here is the call graph for this function:

◆ FormatInfluxDBValue() [6/7]

std::string Metric::FormatInfluxDBValue ( std::string const &  value)
staticprivate

Definition at line 278 of file Metric.cpp.

◆ FormatInfluxDBValue() [7/7]

template<class T >
std::string Metric::FormatInfluxDBValue ( value)
staticprivate

Definition at line 273 of file Metric.cpp.

◆ GetDataStream()

std::iostream & Metric::GetDataStream ( )
inlineprivate

Definition at line 71 of file Metric.h.

+ Here is the caller graph for this function:

◆ Initialize()

void Metric::Initialize ( std::string const &  realmName,
Trinity::Asio::IoContext ioContext,
std::function< void()>  overallStatusLogger 
)

Definition at line 27 of file Metric.cpp.

+ Here is the call graph for this function:

◆ instance()

Metric * Metric::instance ( )
static

Definition at line 317 of file Metric.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsEnabled()

bool Metric::IsEnabled ( ) const
inline

Definition at line 146 of file Metric.h.

◆ LoadFromConfigs()

void Metric::LoadFromConfigs ( )

Definition at line 53 of file Metric.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogEvent()

void Metric::LogEvent ( std::string  category,
std::string  title,
std::string  description 
)

Definition at line 125 of file Metric.cpp.

◆ LogValue()

template<class T , class... TagsList>
void Metric::LogValue ( std::string  category,
value,
TagsList &&...  tags 
)
inline

Definition at line 116 of file Metric.h.

◆ ScheduleOverallStatusLog()

void Metric::ScheduleOverallStatusLog ( )
private

Definition at line 254 of file Metric.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ScheduleSend()

void Metric::ScheduleSend ( )
private

Definition at line 224 of file Metric.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendBatch()

void Metric::SendBatch ( )
private

Definition at line 139 of file Metric.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ShouldLog()

bool Metric::ShouldLog ( std::string const &  category,
int64  value 
) const

Definition at line 117 of file Metric.cpp.

◆ Unload()

void Metric::Unload ( )

Definition at line 241 of file Metric.cpp.

+ Here is the call graph for this function:

◆ Update()

void Metric::Update ( )

Definition at line 108 of file Metric.cpp.

Member Data Documentation

◆ _batchTimer

std::unique_ptr<Trinity::Asio::DeadlineTimer> Metric::_batchTimer
private

Definition at line 74 of file Metric.h.

◆ _databaseName

std::string Metric::_databaseName
private

Definition at line 82 of file Metric.h.

◆ _dataStream

std::unique_ptr<std::iostream> Metric::_dataStream
private

Definition at line 72 of file Metric.h.

◆ _enabled

bool Metric::_enabled = false
private

Definition at line 78 of file Metric.h.

◆ _hostname

std::string Metric::_hostname
private

Definition at line 80 of file Metric.h.

◆ _overallStatusLogger

std::function<void()> Metric::_overallStatusLogger
private

Definition at line 83 of file Metric.h.

◆ _overallStatusTimer

std::unique_ptr<Trinity::Asio::DeadlineTimer> Metric::_overallStatusTimer
private

Definition at line 75 of file Metric.h.

◆ _overallStatusTimerInterval

int32 Metric::_overallStatusTimerInterval = 0
private

Definition at line 77 of file Metric.h.

◆ _overallStatusTimerTriggered

bool Metric::_overallStatusTimerTriggered = false
private

Definition at line 79 of file Metric.h.

◆ _port

std::string Metric::_port
private

Definition at line 81 of file Metric.h.

◆ _queuedData

MPSCQueue<MetricData, &MetricData::QueueLink> Metric::_queuedData
private

Definition at line 73 of file Metric.h.

◆ _realmName

std::string Metric::_realmName
private

Definition at line 84 of file Metric.h.

◆ _thresholds

std::unordered_map<std::string, int64> Metric::_thresholds
private

Definition at line 85 of file Metric.h.

◆ _updateInterval

int32 Metric::_updateInterval = 0
private

Definition at line 76 of file Metric.h.


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