Sha256: 862f01ab6edc08734ca961d6a171c5a5ec8fac9238a76d2fb096f3a7af3b7a8a
Contents?: true
Size: 661 Bytes
Versions: 5
Compression:
Stored size: 661 Bytes
Contents
module Collectd # EventMachine support stuff. Included in Collectd::Plugin. module EmPlugin ## # Attaches additional callback and errback to deferrable to track # a common set of success/error rate/latency def track_deferrable(name, deferrable) attach_time = Time.now deferrable.callback do |*a| push_deferrable_values("#{name}_success", attach_time) end deferrable.errback do |*a| push_deferrable_values("#{name}_error", attach_time) end end def push_deferrable_values(name, attach_time) latency(name).gauge = Time.now - attach_time counter(name).count! 1 end end end
Version data entries
5 entries across 5 versions & 2 rubygems