Class: NewRelic::Agent::NewRelicService::JsonMarshaller
- Inherits:
-
Marshaller
- Object
- Marshaller
- NewRelic::Agent::NewRelicService::JsonMarshaller
- Defined in:
- lib/new_relic/agent/new_relic_service.rb
Overview
Marshal collector protocol with JSON when available
Instance Attribute Summary
Attributes inherited from Marshaller
Class Method Summary collapse
Instance Method Summary collapse
- #dump(ruby) ⇒ Object
- #encode_compress(data) ⇒ Object
- #format ⇒ Object
-
#initialize ⇒ JsonMarshaller
constructor
A new instance of JsonMarshaller.
- #load(data) ⇒ Object
Methods inherited from Marshaller
Constructor Details
#initialize ⇒ JsonMarshaller
Returns a new instance of JsonMarshaller.
359 360 361 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 359 def initialize NewRelic::Agent.logger.debug 'Using JSON marshaller' end |
Class Method Details
.is_supported? ⇒ Boolean
383 384 385 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 383 def self.is_supported? RUBY_VERSION >= '1.9.2' end |
Instance Method Details
#dump(ruby) ⇒ Object
363 364 365 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 363 def dump(ruby) compress(JSON.dump(prepare(ruby))) end |
#encode_compress(data) ⇒ Object
375 376 377 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 375 def encode_compress(data) Base64.encode64(compress(JSON.dump(data), :force => true)) end |
#format ⇒ Object
379 380 381 |
# File 'lib/new_relic/agent/new_relic_service.rb', line 379 def format 'json' end |