https://github.com/landakram/lua-resty-statsd
https://github.com/landakram/lua-resty-statsd
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/landakram/lua-resty-statsd
- Owner: landakram
- Created: 2020-03-30T22:42:49.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-01T03:15:58.000Z (about 5 years ago)
- Last Synced: 2025-01-19T06:30:14.266Z (3 months ago)
- Language: Lua
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
Lua Statsd client for OpenResty
=================`lua-resty-statsd` is an application of the [patch](https://github.com/mediba-system/lua-resty-statsd/blob/master/src/resty_statsd.patch) to take advantage of the Nginx cosoket to `lua-statsd-client`.
`lua-statsd-client` is a [Statsd](https://github.com/etsy/statsd) client for Lua. It supports all Statsd meter types.Installation
------------```sh
% luarocks install lua-resty-statsd
```Usage
-----```lua
-- 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