See our documentation configuring statistics.

Reporting statistics

Reporting statistics from plugins is preferably done using the module:measure() Module API method. This generates an internal name like "/hostname/mod_pluginname/some:counter"

See documentation about util.statistics.

For use in other core modules or more control over the name generated

local measure = require "core.modulemanager".measure;

local ctr = measure("counter", "some");

Retrieving statistics

Note: This is only useful if internal statistics collection is used.

The function get_stats() returns three tables:

  • Map of values for all measures, even if it has not been reported since the last collection
  • Map of values reported during the last collection
  • Extra data attached to measures