Sha256: 0770f8044c11332ff0fabf3ba883382c076095b94f9073addd53450ff8b5f636
Contents?: true
Size: 851 Bytes
Versions: 1
Compression:
Stored size: 851 Bytes
Contents
require 'fozzie/adapter/statsd' module Fozzie module Adapter class Datadog < Statsd # stats is a collection of hashes in the following format: # { :bucket => stat, :value => value, :type => type, :sample_rate => sample_rate, tags => ["serviceid:fozzie","country:au"] } def register(*stats) metrics = stats.flatten.map do |stat| next if sampled?(stat[:sample_rate]) bucket = format_bucket(stat[:bucket]) value = format_value(stat[:value], stat[:type], stat[:sample_rate]) tags = (stat[:tags] || []).map {|tag| tag.gsub(/[,\|]/, RESERVED_CHARS_REPLACEMENT)} result = "#{bucket}:#{value}" result << "|##{tags.join(',')}" if tags.any? result end.compact.join(BULK_DELIMETER) send_to_socket(metrics) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fozzie-1.1.0 | lib/fozzie/adapter/datadog.rb |