comparison mod_statsd/mod_statsd.lua @ 1448:d722a4defea7

mod_statsd: Optionally include host in prefix
author daurnimator <quae@daurnimator.com>
date Mon, 23 Jun 2014 16:05:54 -0400
parents e96ac4291b36
children 365f6db9531a
comparison
equal deleted inserted replaced
1447:e96ac4291b36 1448:d722a4defea7
19 19
20 -- A 'safer' send function to expose 20 -- A 'safer' send function to expose
21 function send(s) return sock:send(s) end 21 function send(s) return sock:send(s) end
22 22
23 -- prefix should end in "." 23 -- prefix should end in "."
24 local prefix = (options.prefix or ("prosody." .. clean(module.host))) .. "." 24 local prefix = (options.prefix or "prosody") .. "."
25 if not options.no_host then
26 prefix = prefix .. clean(module.host) .. "."
27 end
25 28
26 -- Track users as they bind/unbind 29 -- Track users as they bind/unbind
27 -- count bare sessions every time, as we have no way to tell if it's a new bare session or not 30 -- count bare sessions every time, as we have no way to tell if it's a new bare session or not
28 module:hook("resource-bind", function(event) 31 module:hook("resource-bind", function(event)
29 send(prefix.."bare_sessions:"..iterators.count(bare_sessions).."|g") 32 send(prefix.."bare_sessions:"..iterators.count(bare_sessions).."|g")