Hi,

Here is a new version of the Puppet Instrumentation Framework.

I believe the patch has now reached the maturity needed to let it
live its own life in the Puppet ecosystem.

This is mostly the previous patch with all comments taken into account
along with some bug fixes.

Architecture:
The PIF is built with 3 elements:
 * probes: they decorate a puppet method with instrumentation code
 for a given label and instrumentation data.
 
 * the instrumentation listeners: those are observers of instrumentation
 events for a given label (or all, or a subset). Those are plugins that 
 can be added and enabled on demand. They are responsible of computing/
 maintaining the instrumentation data.

 * the instrumentation middleware: it receives the instrumentation events
 from the probes and broadcast those to the interested listeners.

The PIF adds 3 indirection usable through REST to control the framework:

 * instrumentation_listeners: to list, enable or disable listeners
 * instrumentation_data: to get access to the instrumentation data
 * instrumentation_probe: to control the instrumentation probes
 
Usage:
1) Add this to your auth.conf:
path /instrumentation_listener
auth any
method find,search,save
allow *

path /instrumentation_data
auth any
method find
allow *

path /instrumentation_probe
auth any
allow *

(adjust the security to your needs)

2) Obviously launch your master

3) Enable the probes:
curl -k -H 'Accept: pson' -X PUT -H "Content-Type: text/pson" \
 -d "{}" "https://localhost:8140/production/instrumentation_probe/all";

4) Enable the log listener to try it:
curl -k -H 'Accept: pson' -X PUT -H "Content-Type: text/pson" \
 -d 
"{\"document_type\":\"Puppet::Util::Instrumentation::Listener\",\"data\":{\"enabled\":true,\"name\":\"log\"}}"
 \
 "https://localhost:8140/production/instrumentation_listener/log";

5) let some client use the master

6) Get back some instrumentation data from the log listener:
curl -k -H 'Accept: pson' 
"https://localhost:8140/production/instrumentation_data/log";

7) Enjoy

Things to know:
I only shipped 3 listeners, and nothing revolutionnary, my point was just to
provide the framework so that crazier people than me can do more crazy things.

I added only 4 probes to the puppet code (the 4 main verbs of the indirector), 
as an example 
on how to set probes in the code.

There is no "puppet instrumentation" application. It is possible that adding 
instrumentation
faces would be the way to go, but I didn't exactly had time to investigate 
this. Meanwhile, 
The PIF can be controlled through the REST interface with resty or curl 
(I have a bash script doing this available on request).

For the brave souls out there, the code is available there:
https://github.com/masterzen/puppet/tree/feature/instrumentation

As usual, comments, questions and flames are more than welcome,
Brice

Brice Figureau (8):
  Instrumentation foundation layer
  Add indirection (REST usable) to manipulate instrumentation
  Add a way to add probe to puppet code
  Add the example 'log' listener
  Add the 'performance' instrumentation listener
  Process name instrumentation listener
  Add probe indirection for probe management
  Example probes for the indirector

 lib/puppet/application.rb                          |    3 +
 lib/puppet/indirector/indirection.rb               |    7 +
 lib/puppet/indirector/instrumentation_data.rb      |    3 +
 .../indirector/instrumentation_data/local.rb       |   19 ++
 lib/puppet/indirector/instrumentation_data/rest.rb |    5 +
 lib/puppet/indirector/instrumentation_listener.rb  |    3 +
 .../indirector/instrumentation_listener/local.rb   |   20 +++
 .../indirector/instrumentation_listener/rest.rb    |    5 +
 lib/puppet/indirector/instrumentation_probe.rb     |    3 +
 .../indirector/instrumentation_probe/local.rb      |   24 +++
 .../indirector/instrumentation_probe/rest.rb       |    5 +
 lib/puppet/util/instrumentation.rb                 |  165 +++++++++++++++++++
 lib/puppet/util/instrumentation/Instrumentable.rb  |  139 ++++++++++++++++
 lib/puppet/util/instrumentation/data.rb            |   33 ++++
 .../util/instrumentation/indirection_probe.rb      |   29 ++++
 lib/puppet/util/instrumentation/listener.rb        |   62 +++++++
 lib/puppet/util/instrumentation/listeners/log.rb   |   24 +++
 .../util/instrumentation/listeners/performance.rb  |   28 +++
 .../util/instrumentation/listeners/process_name.rb |  103 ++++++++++++
 spec/unit/application_spec.rb                      |    6 +
 .../indirector/instrumentation_data/local_spec.rb  |   52 ++++++
 .../indirector/instrumentation_data/rest_spec.rb   |   11 ++
 .../instrumentation_listener/local_spec.rb         |   58 +++++++
 .../instrumentation_listener/rest_spec.rb          |   11 ++
 .../indirector/instrumentation_probe/local_spec.rb |   65 ++++++++
 .../indirector/instrumentation_probe/rest_spec.rb  |   11 ++
 spec/unit/util/instrumentation/data_spec.rb        |   35 ++++
 .../util/instrumentation/indirection_probe_spec.rb |   19 ++
 .../util/instrumentation/instrumentable_spec.rb    |  173 ++++++++++++++++++++
 spec/unit/util/instrumentation/listener_spec.rb    |   88 ++++++++++
 .../util/instrumentation/listeners/log_spec.rb     |   35 ++++
 .../instrumentation/listeners/performance_spec.rb  |   37 ++++
 .../instrumentation/listeners/process_name_spec.rb |  169 +++++++++++++++++++
 spec/unit/util/instrumentation_spec.rb             |  136 +++++++++++++++
 34 files changed, 1586 insertions(+), 0 deletions(-)
 create mode 100644 lib/puppet/indirector/instrumentation_data.rb
 create mode 100644 lib/puppet/indirector/instrumentation_data/local.rb
 create mode 100644 lib/puppet/indirector/instrumentation_data/rest.rb
 create mode 100644 lib/puppet/indirector/instrumentation_listener.rb
 create mode 100644 lib/puppet/indirector/instrumentation_listener/local.rb
 create mode 100644 lib/puppet/indirector/instrumentation_listener/rest.rb
 create mode 100644 lib/puppet/indirector/instrumentation_probe.rb
 create mode 100644 lib/puppet/indirector/instrumentation_probe/local.rb
 create mode 100644 lib/puppet/indirector/instrumentation_probe/rest.rb
 create mode 100644 lib/puppet/util/instrumentation.rb
 create mode 100644 lib/puppet/util/instrumentation/Instrumentable.rb
 create mode 100644 lib/puppet/util/instrumentation/data.rb
 create mode 100644 lib/puppet/util/instrumentation/indirection_probe.rb
 create mode 100644 lib/puppet/util/instrumentation/listener.rb
 create mode 100644 lib/puppet/util/instrumentation/listeners/log.rb
 create mode 100644 lib/puppet/util/instrumentation/listeners/performance.rb
 create mode 100644 lib/puppet/util/instrumentation/listeners/process_name.rb
 create mode 100644 spec/unit/indirector/instrumentation_data/local_spec.rb
 create mode 100644 spec/unit/indirector/instrumentation_data/rest_spec.rb
 create mode 100644 spec/unit/indirector/instrumentation_listener/local_spec.rb
 create mode 100644 spec/unit/indirector/instrumentation_listener/rest_spec.rb
 create mode 100644 spec/unit/indirector/instrumentation_probe/local_spec.rb
 create mode 100644 spec/unit/indirector/instrumentation_probe/rest_spec.rb
 create mode 100755 spec/unit/util/instrumentation/data_spec.rb
 create mode 100644 spec/unit/util/instrumentation/indirection_probe_spec.rb
 create mode 100755 spec/unit/util/instrumentation/instrumentable_spec.rb
 create mode 100755 spec/unit/util/instrumentation/listener_spec.rb
 create mode 100755 spec/unit/util/instrumentation/listeners/log_spec.rb
 create mode 100755 spec/unit/util/instrumentation/listeners/performance_spec.rb
 create mode 100755 
spec/unit/util/instrumentation/listeners/process_name_spec.rb
 create mode 100755 spec/unit/util/instrumentation_spec.rb

-- 
1.7.5.1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to