Instrumentation foundation layer
This is the base of the instrumentation layer.
The idea is to allow instrumentation of code blocks.
Each time this code is executed an event is fired to some event
listeners that in turn can do whatever is needed to perform the instrumentation.
This patch adds:
- code instrumentation calls
- the listener system
Listeners are added by adding a file to puppet/util/instrumentation/listeners
containing:
Puppet::Util::Instrumentation.new_listener(:my_instrumentation, pattern) do
def notify(label, event, data) ... do something for data... end
end
It is possible to use a "pattern". The listener will be notified only
if the pattern match the label of the event.
The pattern can be a symbol, a string or a regex.
If no pattern is provided, then the listener will be notified for every
event.
The notify method will be called before and after the insturmented code
is executed, with respectively an event of :start and then :stop.
This class is thread-safe.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>