# File lib/puppet/transaction.rb, line 383
383:     def generate_report
384:         @resourcemetrics[:failed] = @failures.find_all do |name, num|
385:             num > 0
386:         end.length
387: 
388:         # Get the total time spent
389:         @timemetrics[:total] = @timemetrics.inject(0) do |total, vals|
390:             total += vals[1]
391:             total
392:         end
393: 
394:         # Add all of the metrics related to resource count and status
395:         @report.newmetric(:resources, @resourcemetrics)
396: 
397:         # Record the relative time spent in each resource.
398:         @report.newmetric(:time, @timemetrics)
399: 
400:         # Then all of the change-related metrics
401:         @report.newmetric(:changes,
402:             :total => @changes.length
403:         )
404: 
405:         @report.time = Time.now
406: 
407:         return @report
408:     end