Class: Puppet::Util::Instrumentation::Data
Overview
This is just a transport class to be used through the instrumentation_data indirection. All the data resides in the real underlying listeners which this class delegates to.
Constant Summary
Constants included
from Indirector
Indirector::BadNameRegexp
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Indirector
configure_routes, indirects
Constructor Details
#initialize(listener_name) ⇒ Data
Returns a new instance of Data.
14
15
16
17
|
# File 'lib/puppet/util/instrumentation/data.rb', line 14
def initialize(listener_name)
@listener = Puppet::Util::Instrumentation[listener_name]
raise "Listener #{listener_name} wasn't registered" unless @listener
end
|
Instance Attribute Details
12
13
14
|
# File 'lib/puppet/util/instrumentation/data.rb', line 12
def listener
@listener
end
|
Class Method Details
.from_data_hash(data) ⇒ Object
38
39
40
|
# File 'lib/puppet/util/instrumentation/data.rb', line 38
def self.from_data_hash(data)
data
end
|
.from_pson(data) ⇒ Object
42
43
44
45
|
# File 'lib/puppet/util/instrumentation/data.rb', line 42
def self.from_pson(data)
Puppet.deprecation_warning("from_pson is being removed in favour of from_data_hash.")
data
end
|
Instance Method Details
19
20
21
|
# File 'lib/puppet/util/instrumentation/data.rb', line 19
def name
@listener.name
end
|
#to_data_hash ⇒ Object
23
24
25
|
# File 'lib/puppet/util/instrumentation/data.rb', line 23
def to_data_hash
{ :name => name }.merge(@listener.respond_to?(:data) ? @listener.data : {})
end
|
#to_pson(*args) ⇒ Object
34
35
36
|
# File 'lib/puppet/util/instrumentation/data.rb', line 34
def to_pson(*args)
to_pson_data_hash.to_pson(*args)
end
|
#to_pson_data_hash ⇒ Object
27
28
29
30
31
32
|
# File 'lib/puppet/util/instrumentation/data.rb', line 27
def to_pson_data_hash
{
'document_type' => "Puppet::Util::Instrumentation::Data",
'data' => to_data_hash,
}
end
|