Sha256: 69234c2b99e903b6eea10e4f6952cc79dd0cbcfe90ef4e7c809c0affcd0521e3
Contents?: true
Size: 581 Bytes
Versions: 1
Compression:
Stored size: 581 Bytes
Contents
module Fozzie class BulkDsl include Fozzie::Interface def initialize(&block) @metrics = [] block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? send_bulk end private # Cache the requested metrics for bulk sending def send(stat, value, type, sample_rate = 1, extra = {}) val = extra.merge({ :bucket => stat, :value => value, :type => type, :sample_rate => sample_rate }) @metrics.push(val) end def send_bulk return if @metrics.empty? adapter.register(@metrics) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fozzie-1.1.0 | lib/fozzie/bulk_dsl.rb |