Sha256: 4949f2a3502100b557db79a35cac6d58e8dc34646ddf2907b54e1a601759af2c

Contents?: true

Size: 1.08 KB

Versions: 68

Compression:

Stored size: 1.08 KB

Contents

require 'puppet/indirector'
require 'puppet/util/instrumentation'

# 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.
class Puppet::Util::Instrumentation::Data
  extend Puppet::Indirector

  indirects :instrumentation_data, :terminus_class => :local

  attr_reader :listener

  def initialize(listener_name)
    @listener = Puppet::Util::Instrumentation[listener_name]
    raise "Listener #{listener_name} wasn't registered" unless @listener
  end

  def name
    @listener.name
  end

  def to_data_hash
    { :name => name }.merge(@listener.respond_to?(:data) ? @listener.data : {})
  end

  def to_pson_data_hash
    {
      'document_type' => "Puppet::Util::Instrumentation::Data",
      'data' => to_data_hash,
    }
  end

  def to_pson(*args)
    to_pson_data_hash.to_pson(*args)
  end

  def self.from_data_hash(data)
    data
  end

  def self.from_pson(data)
    Puppet.deprecation_warning("from_pson is being removed in favour of from_data_hash.")
    data
  end
end

Version data entries

68 entries across 68 versions & 2 rubygems

Version Path
puppet-retrospec-0.12.2 vendor/gems/puppet-3.7.3/lib/puppet/util/instrumentation/data.rb
puppet-3.8.7 lib/puppet/util/instrumentation/data.rb
puppet-3.8.7-x86-mingw32 lib/puppet/util/instrumentation/data.rb
puppet-3.8.7-x64-mingw32 lib/puppet/util/instrumentation/data.rb
puppet-3.8.6 lib/puppet/util/instrumentation/data.rb
puppet-3.8.6-x86-mingw32 lib/puppet/util/instrumentation/data.rb
puppet-retrospec-0.12.1 vendor/gems/puppet-3.7.3/lib/puppet/util/instrumentation/data.rb
puppet-3.8.6-x64-mingw32 lib/puppet/util/instrumentation/data.rb
puppet-retrospec-0.12.0 vendor/gems/puppet-3.7.3/lib/puppet/util/instrumentation/data.rb
puppet-3.8.5 lib/puppet/util/instrumentation/data.rb
puppet-3.8.5-x86-mingw32 lib/puppet/util/instrumentation/data.rb
puppet-3.8.5-x64-mingw32 lib/puppet/util/instrumentation/data.rb
puppet-3.8.4 lib/puppet/util/instrumentation/data.rb
puppet-3.8.4-x86-mingw32 lib/puppet/util/instrumentation/data.rb
puppet-3.8.4-x64-mingw32 lib/puppet/util/instrumentation/data.rb
puppet-retrospec-0.11.0 vendor/gems/puppet-3.7.3/lib/puppet/util/instrumentation/data.rb
puppet-retrospec-0.10.0 vendor/gems/puppet-3.7.3/lib/puppet/util/instrumentation/data.rb
puppet-retrospec-0.9.1 vendor/gems/puppet-3.7.3/lib/puppet/util/instrumentation/data.rb
puppet-retrospec-0.9.0 vendor/gems/puppet-3.7.3/lib/puppet/util/instrumentation/data.rb
puppet-retrospec-0.8.1 vendor/gems/puppet-3.7.3/lib/puppet/util/instrumentation/data.rb