summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-12-29 14:26:47 -0800
committerPaul Berry <paul@puppetlabs.com>2010-12-30 11:51:49 -0800
commit71db5be0ecc5ab591e01974ba109f621348fdea0 (patch)
tree0be294725a57b5f61d46ca1940817b94c50cf642 /lib
parenta4e40f4dd5990df4dc6b2be065e82a142a31b6fc (diff)
downloadpuppet-71db5be0ecc5ab591e01974ba109f621348fdea0.tar.gz
puppet-71db5be0ecc5ab591e01974ba109f621348fdea0.tar.xz
puppet-71db5be0ecc5ab591e01974ba109f621348fdea0.zip
(#5715) Made the changes/total and events/total metrics always present
Previously these metrics were omitted when their values were zero.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/transaction/report.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb
index 6eac6514b..16b854afc 100644
--- a/lib/puppet/transaction/report.rb
+++ b/lib/puppet/transaction/report.rb
@@ -46,7 +46,7 @@ class Puppet::Transaction::Report
def finalize_report
calculate_resource_metrics
calculate_time_metrics
- calculate_change_metrics
+ calculate_change_metric
calculate_event_metrics
end
@@ -107,17 +107,14 @@ class Puppet::Transaction::Report
private
- def calculate_change_metrics
- metrics = Hash.new(0)
- resource_statuses.each do |name, status|
- metrics[:total] += status.change_count if status.change_count
- end
-
- add_metric(:changes, metrics)
+ def calculate_change_metric
+ total = resource_statuses.map { |name, status| status.change_count || 0 }.inject(0) { |a,b| a+b }
+ add_metric(:changes, {:total => total})
end
def calculate_event_metrics
metrics = Hash.new(0)
+ metrics[:total] = 0
resource_statuses.each do |name, status|
metrics[:total] += status.events.length
status.events.each do |event|