Skip to content
Browse files

Added more logging on each step of munge_catalog

  • Loading branch information...
1 parent 3696213 commit 335ffa6e1b2108cda61dd1c022c3fc60540c16bf @senior committed Feb 21, 2014
Showing with 21 additions and 9 deletions.
  1. +21 −9 puppet/lib/puppet/indirector/catalog/puppetdb.rb
View
30 puppet/lib/puppet/indirector/catalog/puppetdb.rb
@@ -31,15 +31,27 @@ def munge_catalog(catalog, extra_request_data = {}, msg_idx = -1)
hash = catalog.to_pson_data_hash
data = hash['data']
+
+ Puppet::Util::Puppetdb.time_and_log("#{msg_idx} - Addming missing parameters: %s ms",
+ lambda { add_parameters_if_missing(data) })
+
+ Puppet::Util::Puppetdb.time_and_log("#{msg_idx} - Adding namevar aliases: %s ms",
+ lambda { add_namevar_aliases(data, catalog) })
+
+ Puppet::Util::Puppetdb.time_and_log("#{msg_idx} - Stringifying titles: %s ms",
+ lambda { stringify_titles(data) })
+
+ Puppet::Util::Puppetdb.time_and_log("#{msg_idx} - Submitting catalog to PuppetDB: %s ms",
+ lambda { sort_unordered_metaparams(data, msg_idx) })
- add_parameters_if_missing(data)
- add_namevar_aliases(data, catalog)
- stringify_titles(data)
- sort_unordered_metaparams(data, msg_idx)
- munge_edges(data, msg_idx)
- synthesize_edges(data, catalog)
- filter_keys(hash)
- add_transaction_uuid(data, extra_request_data[:transaction_uuid])
+ Puppet::Util::Puppetdb.time_and_log("#{msg_idx} - Submitting catalog to PuppetDB: %s ms",
+ lambda { munge_edges(data, msg_idx) })
+ Puppet::Util::Puppetdb.time_and_log("#{msg_idx} - Submitting catalog to PuppetDB: %s ms",
+ lambda { synthesize_edges(data, catalog) })
+ Puppet::Util::Puppetdb.time_and_log("#{msg_idx} - Submitting catalog to PuppetDB: %s ms",
+ lambda { filter_keys(hash) })
+ Puppet::Util::Puppetdb.time_and_log("#{msg_idx} - Submitting catalog to PuppetDB: %s ms",
+ lambda { add_transaction_uuid(data, extra_request_data[:transaction_uuid]) })
hash
end
@@ -132,7 +144,7 @@ def sort_unordered_metaparams(hash, msg_idx = -1)
end
end
- avg_params = (num_params / total_resources).round
+ avg_params = num_params / total_resources
Puppet.info("#{msg_idx} - Total number of resources: #{total_resources} - Average number of params: #{avg_params}")
hash
end

0 comments on commit 335ffa6

Please sign in to comment.
Something went wrong with that request. Please try again.