Skip to end of metadata
Go to start of metadata

Required Software

Statistic and metric logging in TrinityCore is implemented using two projects, InfluxDB, a time-series data storage and Grafana, graph and a dashboard builder for visualizing time series metrics.

Installing InfluxDB

  1. Download and install InfluxDB from for your platform

  2. Create n user and a database for TC using the Influx CLI

    CREATE DATABASE worldserver
    CREATE USER grafana WITH PASSWORD 'grafana'
    GRANT READ ON worldserver TO grafana

Installing Grafana

  1. Download and install Grafana from
  2. Open the dashboard at http://localhost:3000
  3. Login with username admin and password admin (defaults can be changed in Grafana's .ini files)
  4. Go to Data Sources → + Add Data Source
    Name: Influx
    Type: InfluxDB
    Access: Proxy
    Database: worldserver User: grafana Password: grafana
  5. Go to Dashboards Import and import each .json file in TrinityCore's /contrib/grafana

Configuring TrinityCore

  1. Edit the worldserver.conf file
  2. Set Metric.Enable = 1
  3. Edit Metric.ConnectionInfo with connection details (e.g ";8086;worldserver")
  4. Start worldserver, the dashboard should now start receiving values

Implemented (tick) and planned (error) metrics

Technical oriented

  • I/O networking traffic:
    • Packets sent (error)
    • Packets received (tick)
    • Average ping (error)
    • Traffic in (error)
    • Traffic out (error)
  • World session update time (tick)
  • Map update time (error)
  • Map loads/unloads (tick)
  • MMap queries (tick)
  • Database async queries queued count (error)
  • Server uptime (tick) (through world initialize and world shutdown events)
  • Active connections (error)
  • Queued connections (error)

Game oriented

  • Players online (tick)
  • Logins per hour, per day, day of week, etc (tick)
  • Mails sent (error)
  • Auction house usage (error)
  • Character levels (error)
  • Gold earn/spend (error)
  • LFG queues (error)

We'd like help implementing these and other metrics, feel free to send us a pull request.

Adding new metrics

There are two kinds of metrics that can be logged: values and events.

Values correspond to measurements of a certain quantity, like number of online players or the update diff time.

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(category, title, description)
  • category: Arbitrary string, table where the values and events are stored. By convention, event logs should be suffixed by "_events";
  • title: Name of the event log;
  • description: Additional info about a log event;
TC_METRIC_VALUE(category, value)
  • 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).

// 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 visualizations and metrics collection

InfluxDB is part of a bigger set of projects by InfluxData which integrate nicely with the DB:

  • Telegraf can be used to collect system metrics like CPU, I/O, memory usage and other services such as MySQL – to display this info next to the TC metrics.
  • Chronograf is an alternative to Grafana to graph and visualize time-series metrics.
  • Kapacitator is able to process streaming data from InfluxDB to provide alerts, trigger events, detect anomalies or transform data.

Additional Reading

Learn more about InfluxDB and Grafana:

1 Comment

  1. Update - Windows x64 x86 binaries have been released