HomePhorge

Add a way to add probe to puppet code
ff36debe66a9Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

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>

Details

Provenance
Brice Figureau <brice-puppet@daysofwonder.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU6b7fcf620f5c: Add indirection (REST usable) to manipulate instrumentation
Branches
Unknown
Tags
Unknown

Event Timeline

Brice Figureau <brice-puppet@daysofwonder.com> committed rPUff36debe66a9: Add a way to add probe to puppet code (authored by Brice Figureau <brice-puppet@daysofwonder.com>).Dec 21 2011, 8:12 PM