feat(Core/Metrics): implement real time statistic visualization (#8663)

This commit is contained in:
Kargatum
2021-10-28 19:47:29 +07:00
committed by GitHub
parent 7c363c9040
commit a650fd495c
21 changed files with 4798 additions and 31 deletions

View File

@@ -37,6 +37,7 @@
#include "GitRevision.h"
#include "IoContext.h"
#include "MapMgr.h"
#include "Metric.h"
#include "MySQLThreading.h"
#include "ObjectAccessor.h"
#include "OpenSSLCrypto.h"
@@ -288,6 +289,22 @@ int main(int argc, char** argv)
LoadRealmInfo(*ioContext);
sMetric->Initialize(realm.Name, *ioContext, []()
{
METRIC_VALUE("online_players", sWorld->GetPlayerCount());
METRIC_VALUE("db_queue_login", uint64(LoginDatabase.QueueSize()));
METRIC_VALUE("db_queue_character", uint64(CharacterDatabase.QueueSize()));
METRIC_VALUE("db_queue_world", uint64(WorldDatabase.QueueSize()));
});
METRIC_EVENT("events", "Worldserver started", "");
std::shared_ptr<void> sMetricHandle(nullptr, [](void*)
{
METRIC_EVENT("events", "Worldserver shutdown", "");
sMetric->Unload();
});
// Loading modules configs
sConfigMgr->PrintLoadedModulesConfigs();

View File

@@ -31,6 +31,7 @@
# LOGGING SYSTEM SETTINGS
# PACKET SPOOF PROTECTION SETTINGS
# DEBUG
# METRIC SETTINGS
#
###################################################################################################
@@ -3821,3 +3822,58 @@ Debug.Arena = 0
#
###################################################################################################
###################################################################################################
# METRIC SETTINGS
#
# These settings control the statistics sent to the metric database (currently InfluxDB)
#
# Metric.Enable
# Description: Enables statistics sent to the metric database.
# Default: 0 - (Disabled)
# 1 - (Enabled)
#
Metric.Enable = 0
#
# Metric.Interval
# Description: Interval between every batch of data sent in seconds
# Default: 10 seconds
#
Metric.Interval = 10
#
# Metric.ConnectionInfo
# Description: Connection settings for metric database (currently InfluxDB).
# Example: "hostname;port;database"
# Default: "127.0.0.1;8086;worldserver"
#
Metric.ConnectionInfo = "127.0.0.1;8086;worldserver"
#
# Metric.OverallStatusInterval
# Description: Interval between every gathering of overall worldserver status data in seconds
# Default: 1 second
#
Metric.OverallStatusInterval = 1
#
# Metric threshold values: Given a metric "name"
# Metric.Threshold.name
# Description: Skips sending statistics with a value lower than the config value.
# If the threshold is commented out, the metric will be ignored.
# Only metrics logged with METRIC_DETAILED_TIMER in the sources are affected.
# Disabled by default. Requires WITH_DETAILED_METRICS CMake flag.
#
# Format: Value as integer
#
#Metric.Threshold.world_update_sessions_time = 100
#Metric.Threshold.worldsession_update_opcode_time = 50
#
###################################################################################################