mod_statsd/mod_statsd.lua
changeset 2879 c3a039972b74
parent 2429 26c68a5f432f
equal deleted inserted replaced
2878:178b8abf8283 2879:c3a039972b74
    13 
    13 
    14 -- Create UDP socket to statsd server
    14 -- Create UDP socket to statsd server
    15 local sock = socket.udp()
    15 local sock = socket.udp()
    16 sock:setpeername(options.hostname or "127.0.0.1", options.port or 8125)
    16 sock:setpeername(options.hostname or "127.0.0.1", options.port or 8125)
    17 
    17 
    18 -- Metrics are namespaced by ".", and seperated by newline
    18 -- Metrics are namespaced by ".", and separated by newline
    19 function clean(s) return (s:gsub("[%.:\n]", "_")) end
    19 function clean(s) return (s:gsub("[%.:\n]", "_")) end
    20 
    20 
    21 -- A 'safer' send function to expose
    21 -- A 'safer' send function to expose
    22 function send(s) return sock:send(s) end
    22 function send(s) return sock:send(s) end
    23 
    23