[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Brice Figureau brice-puppet at daysofwonder.com
Tue May 10 08:03:29 UTC 2011


The following commit has been merged in the experimental branch:
commit e27d208db86ae0825afbc6fb34d39e7c047a1bf4
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date:   Sat Dec 18 15:25:02 2010 +0100

    Some high-level process name probes
    
    Here is an attempt to cover with process name probes some of the longest
    parts of a puppet agent or master.
    Currently:
    * node compilation
    * individual resource evaluation
    * some configurer parts
    * individual network requests
    
    Signed-off-by: Brice Figureau <brice-puppet at daysofwonder.com>

diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb
index 31d31c2..4320aa9 100644
--- a/lib/puppet/configurer.rb
+++ b/lib/puppet/configurer.rb
@@ -3,6 +3,7 @@ require 'sync'
 require 'timeout'
 require 'puppet/network/http_pool'
 require 'puppet/util'
+require 'puppet/util/instrumentation'
 
 class Puppet::Configurer
   class CommandHookError < RuntimeError; end
@@ -12,6 +13,7 @@ class Puppet::Configurer
 
   include Puppet::Configurer::FactHandler
   include Puppet::Configurer::PluginHandler
+  include Puppet::Util::Instrumentation
 
   # For benchmarking
   include Puppet::Util
@@ -80,11 +82,17 @@ class Puppet::Configurer
   def prepare
     dostorage
 
-    download_plugins
+    instrument("downloading plugins") do
+      download_plugins
+    end
 
-    download_fact_plugins
+    instrument("downloading facts plugins") do
+      download_fact_plugins
+    end
 
-    execute_prerun_command
+    instrument("executing prerun command") do
+      execute_prerun_command
+    end
   end
 
   # Get the remote catalog, yo.  Returns nil if no catalog can be found.
@@ -148,8 +156,10 @@ class Puppet::Configurer
     transaction = nil
 
     begin
-      benchmark(:notice, "Finished catalog run") do
-        transaction = catalog.apply(options)
+      instrument("applying catalog") do
+        benchmark(:notice, "Finished catalog run") do
+          transaction = catalog.apply(options)
+        end
       end
       report
     rescue => detail
@@ -169,7 +179,9 @@ class Puppet::Configurer
 
     Puppet::Util::Log.close(report)
 
-    send_report(report, transaction)
+    instrument("sending report") do
+      send_report(report, transaction)
+    end
   end
 
   def send_report(report, trans = nil)
diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb
index 82238aa..855a9b7 100644
--- a/lib/puppet/network/http/handler.rb
+++ b/lib/puppet/network/http/handler.rb
@@ -5,10 +5,12 @@ require 'puppet/network/http/api/v1'
 require 'puppet/network/rest_authorization'
 require 'puppet/network/rights'
 require 'resolv'
+require 'puppet/util/instrumentation'
 
 module Puppet::Network::HTTP::Handler
   include Puppet::Network::HTTP::API::V1
   include Puppet::Network::RestAuthorization
+  include Puppet::Util::Instrumentation
 
   attr_reader :server, :handler
 
@@ -65,7 +67,9 @@ module Puppet::Network::HTTP::Handler
 
     check_authorization(indirection, method, key, params)
 
-    send("do_#{method}", indirection, key, params, request, response)
+    instrument("processing #{indirection} #{key}") do
+      send("do_#{method}", indirection, key, params, request, response)
+    end
   rescue SystemExit,NoMemoryError
     raise
   rescue Exception => e
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb
index c60e1d4..7da50c2 100644
--- a/lib/puppet/parser/compiler.rb
+++ b/lib/puppet/parser/compiler.rb
@@ -4,6 +4,7 @@
 require 'puppet/node'
 require 'puppet/resource/catalog'
 require 'puppet/util/errors'
+require 'puppet/util/instrumentation'
 
 require 'puppet/resource/type_collection_helper'
 
@@ -13,9 +14,12 @@ class Puppet::Parser::Compiler
   include Puppet::Util
   include Puppet::Util::Errors
   include Puppet::Resource::TypeCollectionHelper
+  extend Puppet::Util::Instrumentation
 
   def self.compile(node)
-    new(node).compile.to_resource
+    instrument("compiling #{node.name}") do
+      new(node).compile.to_resource
+    end
   rescue => detail
     puts detail.backtrace if Puppet[:trace]
     raise Puppet::Error, "#{detail} on node #{node.name}"
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index dcd9aad..0a3bfc3 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -4,8 +4,11 @@
 require 'puppet'
 require 'puppet/util/tagging'
 require 'puppet/application'
+require 'puppet/util/instrumentation'
 
 class Puppet::Transaction
+  include Puppet::Util::Instrumentation
+
   require 'puppet/transaction/change'
   require 'puppet/transaction/event'
   require 'puppet/transaction/event_manager'
@@ -139,8 +142,10 @@ class Puppet::Transaction
           next
         end
         ret = nil
-        seconds = thinmark do
-          ret = eval_resource(resource)
+        instrument("evaluating #{resource}") do
+          seconds = thinmark do
+            ret = eval_resource(resource)
+          end
         end
 
         resource.info "Evaluated in %0.2f seconds" % seconds if Puppet[:evaltrace] and @catalog.host_config?

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list