lib/instana/agent.rb in instana-1.9.2 vs lib/instana/agent.rb in instana-1.9.3

- old
+ new

@@ -10,13 +10,13 @@ require 'instana/agent/hooks' require 'instana/agent/tasks' include Sys -Oj.default_options = {:mode => :strict} - module Instana + OJ_OPTIONS = {:mode => :strict} + class Agent include AgentHelpers include AgentHooks include AgentTasks @@ -207,18 +207,18 @@ announce_payload[:inode] = File.readlink("/proc/#{Process.pid}/fd/#{socket.fileno}") end uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{DISCOVERY_PATH}") req = Net::HTTP::Put.new(uri) - req.body = Oj.dump(announce_payload) + req.body = Oj.dump(announce_payload, OJ_OPTIONS) ::Instana.logger.debug "Announce: http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{DISCOVERY_PATH} - payload: #{req.body}" response = make_host_agent_request(req) if response && (response.code.to_i == 200) - data = Oj.load(response.body) + data = Oj.load(response.body, OJ_OPTIONS) @process[:report_pid] = data['pid'] @agent_uuid = data['agentUuid'] if data.key?('extraHeaders') @extra_headers = data['extraHeaders'] @@ -249,11 +249,11 @@ path = "com.instana.plugin.ruby.#{@process[:report_pid]}" uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}") req = Net::HTTP::Post.new(uri) - req.body = Oj.dump(payload) + req.body = Oj.dump(payload, OJ_OPTIONS) response = make_host_agent_request(req) if response if response.body && response.body.length > 2 # The host agent returned something indicating that is has a request for us that we @@ -288,10 +288,12 @@ path = "com.instana.plugin.ruby/traces.#{@process[:report_pid]}" uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}") req = Net::HTTP::Post.new(uri) - req.body = Oj.dump(spans, :omit_nil => true) + opts = OJ_OPTIONS.merge({omit_nil: true}) + + req.body = Oj.dump(spans, opts) response = make_host_agent_request(req) if response last_trace_response = response.code.to_i