comparison mod_statsd/mod_statsd.lua @ 1447:e96ac4291b36

mod_statsd: Clean off colons (:)
author daurnimator <quae@daurnimator.com>
date Mon, 23 Jun 2014 16:05:33 -0400
parents faf1a5d89cd7
children d722a4defea7
comparison
equal deleted inserted replaced
1444:56c394b9e60d 1447:e96ac4291b36
13 -- Create UDP socket to statsd server 13 -- Create UDP socket to statsd server
14 local sock = socket.udp() 14 local sock = socket.udp()
15 sock:setpeername(options.hostname or "127.0.0.1", options.port or 8125) 15 sock:setpeername(options.hostname or "127.0.0.1", options.port or 8125)
16 16
17 -- Metrics are namespaced by ".", and seperated by newline 17 -- Metrics are namespaced by ".", and seperated by newline
18 function clean(s) return (s:gsub("[%.\n]", "_")) end 18 function clean(s) return (s:gsub("[%.:\n]", "_")) end
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 "."