Module: Oboe::Inst::EventMachine::HttpConnection

Included in:
EventMachine::HttpConnection
Defined in:
lib/oboe/inst/em-http-request.rb

Instance Method Summary collapse

Instance Method Details

#setup_request_with_oboe(*args, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/oboe/inst/em-http-request.rb', line 5

def setup_request_with_oboe(*args, &block)
  report_kvs = {}
  context = Oboe::Context.toString
  blacklisted = Oboe::API.blacklisted?(@uri)

  begin
    report_kvs['IsService'] = 1
    report_kvs['RemoteURL'] = @uri
    report_kvs['HTTPMethod'] = args[0]
    report_kvs['Blacklisted'] = true if blacklisted

    if Oboe::Config[:em_http_request][:collect_backtraces]
      report_kvs[:Backtrace] = Oboe::API.backtrace
    end
  rescue => e
    Oboe.logger.debug "[oboe/debug] em-http-request KV error: #{e.inspect}"
  end

  ::Oboe::API.log_entry('em-http-request', report_kvs)
  client = setup_request_without_oboe(*args, &block)
  client.req.headers['X-Trace'] = context unless blacklisted
  client
end