Statsd client for OpenResty.
Lua Shell
Clone or download
Pull request Compare This branch is 10 commits ahead of stvp:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.travis
rockspecs
spec
src
.travis.yml
CHANGELOG.md
README.md

README.md

Lua Statsd client for OpenResty

lua-resty-statsd is an application of the patch to take advantage of the Nginx cosoket to lua-statsd-client. lua-statsd-client is a Statsd client for Lua. It supports all Statsd meter types.

Installation

% luarocks install lua-resty-statsd

Usage

-- require constructor
local Statsd = require "statsd"

-- create statsd object, which will open up a persistent port
local statsd = Statsd({
  host = "stats.mysite.com" -- default: 127.0.0.1
  port = 8888 -- default: 8125
  namespace = "mysite.stats" -- default: none
})

statsd:gauge( "users", #my_users_table )
statsd:counter( "events", 5 )
statsd:increment( "events", 1 )
statsd:decrement( "events", 3 )
statsd:timer( "page_render", 105 )
statsd:histogram( "page_render_time", 105 )
statsd:meter( "page_load", 1 )

Original

https://github.com/stvp/lua-statsd-client