lib/fozzie/socket.rb in fozzie-0.0.26 vs lib/fozzie/socket.rb in fozzie-0.0.27

- old
+ new

@@ -2,21 +2,22 @@ module Fozzie module Socket RESERVED_CHARS_REGEX = /[\:\|\@\s]/ + DELIMETER = '.' private # Send the statistic to the server # # Creates the Statsd key from the given values, and sends to socket (depending on sample rate) # def send(stat, delta, type, sample_rate) - stat = [stat].flatten.compact.collect(&:to_s).join('.').downcase - stat = stat.gsub('::', '.').gsub(RESERVED_CHARS_REGEX, '_') + stat = [stat].flatten.compact.collect(&:to_s).join(DELIMETER).downcase + stat = stat.gsub('::', DELIMETER).gsub(RESERVED_CHARS_REGEX, '_') - k = [Fozzie.c.data_prefix, stat].compact.join('.') + k = [Fozzie.c.data_prefix, stat].compact.join(DELIMETER) k << ":" k << [delta, type].join('|') k << '@%s' % sample_rate.to_s if sample_rate < 1 sampled(sample_rate) { send_to_socket(k.strip) } \ No newline at end of file