Sha256: efe719952fca550c61fa39588d466446238bd684e4e6a0dafa2ebad5f5c38613
Contents?: true
Size: 638 Bytes
Versions: 57
Compression:
Stored size: 638 Bytes
Contents
require 'monitor' # This is an example instrumentation listener that stores the last # 20 instrumented probe run time. Puppet::Util::Instrumentation.new_listener(:log) do SIZE = 20 attr_accessor :last_logs def initialize @last_logs = {}.extend(MonitorMixin) end def notify(label, event, data) return if event == :start log_line = "#{label} took #{data[:finished] - data[:started]}" @last_logs.synchronize { (@last_logs[label] ||= []) << log_line @last_logs[label].shift if @last_logs[label].length > SIZE } end def data @last_logs.synchronize { @last_logs.dup } end end
Version data entries
57 entries across 57 versions & 3 rubygems