Skip to content

Instantly share code, notes, and snippets.

@joshcooper
Created February 21, 2014 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshcooper/9140727 to your computer and use it in GitHub Desktop.
Save joshcooper/9140727 to your computer and use it in GitHub Desktop.
diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb
index 0c0cb20..1d759eb 100644
--- a/lib/puppet/indirector/indirection.rb
+++ b/lib/puppet/indirector/indirection.rb
@@ -11,15 +11,19 @@ require 'puppet/util/instrumentation/instrumentable'
class Puppet::Indirector::Indirection
include Puppet::Util::MethodHelper
include Puppet::Util::Docs
+
+ puts "Puppet::Indirector::Indirection extending Instrumentable"
extend Puppet::Util::Instrumentation::Instrumentable
attr_accessor :name, :model
attr_reader :termini
+ puts "Puppet::Indirector::Indirection defining probes"
probe :find, :label => Proc.new { |parent, key, *args| "find_#{parent.name}_#{parent.terminus_class}" }, :data => Proc.new { |parent, key, *args| { :key => key }}
probe :save, :label => Proc.new { |parent, key, *args| "save_#{parent.name}_#{parent.terminus_class}" }, :data => Proc.new { |parent, key, *args| { :key => key }}
probe :search, :label => Proc.new { |parent, key, *args| "search_#{parent.name}_#{parent.terminus_class}" }, :data => Proc.new { |parent, key, *args| { :key => key }}
probe :destroy, :label => Proc.new { |parent, key, *args| "destroy_#{parent.name}_#{parent.terminus_class}" }, :data => Proc.new { |parent, key, *args| { :key => key }}
+ puts "Puppet::Indirector::Indirection defined probes"
@@indirections = []
diff --git a/lib/puppet/util/instrumentation.rb b/lib/puppet/util/instrumentation.rb
index 94a75ac..9f1bf34 100644
--- a/lib/puppet/util/instrumentation.rb
+++ b/lib/puppet/util/instrumentation.rb
@@ -6,15 +6,21 @@ class Puppet::Util::Instrumentation
extend Puppet::Util::ClassGen
extend Puppet::Util::InstanceLoader
+ puts "Puppet::Util::Instrumentation loading"
+
# we're using a ruby lazy autoloader to prevent a loop when requiring listeners
# since this class sets up an indirection which is also used in Puppet::Indirector::Indirection
# which is used to setup indirections...
autoload :Listener, 'puppet/util/instrumentation/listener'
autoload :Data, 'puppet/util/instrumentation/data'
+ puts "Puppet::Util::Instrumentation created ruby autoloaders"
+
# Set up autoloading and retrieving of instrumentation listeners.
instance_load :listener, 'puppet/util/instrumentation/listeners'
+ puts "Puppet::Util::Instrumentation created listener instance loader"
+
class << self
attr_accessor :listeners, :listeners_of
end
@@ -118,11 +124,16 @@ class Puppet::Util::Instrumentation
end
def self.init
+ puts "Puppet::Util::Instrumentation.init"
# let's init our probe indirection
require 'puppet/util/instrumentation/indirection_probe'
+ puts "Puppet::Util::Instrumentation.init required indirection_probe"
+
@listeners ||= {}
@listeners_of ||= {}
+ puts "Puppet::Util::Instrumentation.init loading all listeners"
instance_loader(:listener).loadall
+ puts "Puppet::Util::Instrumentation.init done"
end
def self.clear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment