lib/instana/agent.rb in instana-1.7.15 vs lib/instana/agent.rb in instana-1.8.0
- old
+ new
@@ -14,10 +14,11 @@
attr_accessor :state
attr_accessor :agent_uuid
attr_accessor :process
attr_accessor :collect_thread
attr_accessor :thread_spawn_lock
+ attr_accessor :extra_headers
LOCALHOST = '127.0.0.1'.freeze
MIME_JSON = 'application/json'.freeze
DISCOVERY_PATH = 'com.instana.plugin.ruby.discovery'.freeze
@@ -62,10 +63,13 @@
# The agent UUID returned from the host agent
@agent_uuid = nil
# This will hold info on the discovered agent host
@discovered = nil
+
+ # The agent may pass down custom headers for this sensor to capture
+ @extra_headers = nil
end
# Used post fork to re-initialize state and restart communications with
# the host agent.
#
@@ -219,9 +223,13 @@
if response && (response.code.to_i == 200)
data = Oj.load(response.body)
@process[:report_pid] = data['pid']
@agent_uuid = data['agentUuid']
+
+ if data.key?('extraHeaders')
+ @extra_headers = data['extraHeaders']
+ end
true
else
false
end
rescue => e