Sha256: 71bc1fd57ee2cd67a7b8d1fc8ed7b741f1b9c821fbc8c697e9aa4b65dce5e877
Contents?: true
Size: 522 Bytes
Versions: 74
Compression:
Stored size: 522 Bytes
Contents
# 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 = {} end def notify(label, event, data) return if event == :start log_line = "#{label} took #{data[:finished] - data[:started]}" (@last_logs[label] ||= []) << log_line @last_logs[label].shift if @last_logs[label].length > SIZE end def data @last_logs.dup end end
Version data entries
74 entries across 74 versions & 2 rubygems