Class: Datadog::Encoding::JSONEncoder

Inherits:
Encoder
  • Object
show all
Defined in:
lib/ddtrace/encoding.rb

Overview

Encoder for the JSON format

Instance Attribute Summary

Attributes inherited from Encoder

#content_type

Instance Method Summary collapse

Methods inherited from Encoder

#encode_services, #encode_traces

Constructor Details

#initializeJSONEncoder

Returns a new instance of JSONEncoder.



43
44
45
46
# File 'lib/ddtrace/encoding.rb', line 43

def initialize
  Datadog::Tracer.log.debug('using JSON encoder; application performance may be degraded')
  @content_type = 'application/json'
end

Instance Method Details

#encode(obj) ⇒ Object



48
49
50
# File 'lib/ddtrace/encoding.rb', line 48

def encode(obj)
  JSON.dump(obj)
end