Add a way to add probe to puppet code
This patch contains a module (Instrumentable) that can be mixed in
various puppet classes to help define probes.
To add a probe for a given method, it is just a matter of using
the Instrumentable probe method:
class MyClass
extend Instrumentable probe :thismethod def thismethod(arg) ... end
end
Used with no options the probe is created with a default label of
the instrumented method name and an empty dataset.
It is possible to set a given label, or use a proc as the label, in which
case the label will be the result of the evaluation of the said proc.
For instance:
class MyClass
extend Instrumentable probe :thismethod, :label => Proc.new { |parent,args| args[0] } def thismethod(arg1, arg2) end
end
In this last example, the label will be the value of "arg1".
The parent argument of the :label block will contain the "self"
value of the instrumented method
When the thismethod will be called, it will in turn call the instrumentation
layer with the given label and data.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>