summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/transaction/report.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb
new file mode 100644
index 000000000..93afa284a
--- /dev/null
+++ b/lib/puppet/transaction/report.rb
@@ -0,0 +1,40 @@
+require 'puppet'
+
+# A class for reporting what happens on each client. Reports consist of
+# two types of data: Logs and Metrics. Logs are the output that each
+# change produces, and Metrics are all of the numerical data involved
+# in the transaction.
+class Puppet::Transaction::Report
+ attr_accessor :logs, :metrics
+
+ def initialize
+ @metrics = {}
+ @logs = []
+
+ @records = Hash.new do |hash, key|
+ hash[key] = []
+ end
+ end
+
+ # Create a new metric.
+ def newmetric(name, hash)
+ metric = Puppet::Metric.new(name)
+
+ hash.each do |name, value|
+ metric.newvalue(name, value)
+ end
+
+ @metrics[metric.name] = metric
+ end
+
+ # Add a new log message.
+ def newlog(msg)
+ @logs << msg
+ end
+
+ def record(metric, object)
+ @records[metric] << object
+ end
+end
+
+# $Id$