Class: NewRelic::Agent::NewRelicService::PrubyMarshaller

Inherits:
Marshaller
  • Object
show all
Defined in:
lib/new_relic/agent/new_relic_service.rb

Overview

Primitive Ruby Object Notation which complies JSON format data strutures

Instance Attribute Summary

Attributes inherited from Marshaller

#encoding

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Marshaller

#compress, #parsed_error

Constructor Details

#initializePrubyMarshaller

Returns a new instance of PrubyMarshaller.



325
326
327
# File 'lib/new_relic/agent/new_relic_service.rb', line 325

def initialize
  NewRelic::Agent.logger.debug 'Using Pruby marshaller'
end

Class Method Details

.is_supported?Boolean

Returns:

  • (Boolean)


352
353
354
# File 'lib/new_relic/agent/new_relic_service.rb', line 352

def self.is_supported?
  true
end

Instance Method Details

#dump(ruby) ⇒ Object



329
330
331
332
333
334
335
336
# File 'lib/new_relic/agent/new_relic_service.rb', line 329

def dump(ruby)
  NewRelic::LanguageSupport.with_cautious_gc do
    compress(Marshal.dump(prepare(ruby)))
  end
rescue => e
  NewRelic::Agent.logger.debug("#{e.class.name} : #{e.message} when marshalling #{ruby.inspect}")
  raise
end

#formatObject



348
349
350
# File 'lib/new_relic/agent/new_relic_service.rb', line 348

def format
  'pruby'
end

#load(data) ⇒ Object



338
339
340
341
342
343
344
345
346
# File 'lib/new_relic/agent/new_relic_service.rb', line 338

def load(data)
  return unless data && data != ''
  NewRelic::LanguageSupport.with_cautious_gc do
    return_value(Marshal.load(data))
  end
rescue
  NewRelic::Agent.logger.debug "Error encountered loading collector response: #{data}"
  raise
end