Required Software
Statistic and metric logging in TrinityCore is implemented using two projects, InfluxDB, a time-series data storage and Grafana, graph and dashboard builder for visualizing time series metrics.
Adding new metrics
There are two kinds of metrics that can be logged: values and events.
...
Events are something that occurs in an instant of time, e.g, a player login, worldserver shutdown, etc..
To log new metrics, call TC_METRIC_EVENT
or TC_METRIC_VALUE
and add a new graph to the dashboard.
...
...
TC_METRIC_EVENT
...
(
...
TC_METRIC_EVENT(category, title, description)
...
- category: Same as above;
- value: A measurement, it can have one of the following types: bool, std::string, float, double or any integral type (int, int32, uint, etc).
Bloque de código | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
// Registering player logins: in WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
TC_METRIC_EVENT("player_events", "Login", pCurrChar->GetName());
// Logging the update diff time: in World::Update(uint32 diff)
TC_METRIC_VALUE("update_time_diff", diff); |
Additional Reading
Learn more about InfluxDB and Grafana:
...