util.statistics

This modules allows you to gather and aggregate various statistics easily. It is used by Prosody to offer the module:measure() API. If you are developing a module, you should use that. If you want to expose statistics from core code in Prosody, use core.statsmanager.

Creating a statistics registry

local registry = require "util.statistics".new();

A registry is a collection of statistics, each statistics identified by a string key. No particular format is enforced for the keys.

Counting things

Counting events

Timing things

 
doc/developers/util/statistics.txt · Last modified: 2015/03/10 14:24 by Matthew Wild