class StackifyRubyAPM::Context::Response

@api private

Attributes

finished[RW]
headers[RW]
headers_sent[RW]
status_code[RW]

Public Class Methods

new( status_code, headers: {}, headers_sent: true, finished: true ) click to toggle source
# File lib/stackify_apm/context/response.rb, line 9
def initialize(
  status_code,
  headers: {},
  headers_sent: true,
  finished: true
)
  @status_code = status_code
  headers = make_xstackify_id_header(headers)
  @headers = headers
  @headers_sent = headers_sent
  @finished = finished
end

Public Instance Methods

make_xstackify_id_header(headers) click to toggle source
# File lib/stackify_apm/context/response.rb, line 24
def make_xstackify_id_header(headers)
  return unless StackifyRubyAPM.agent.current_transaction && StackifyRubyAPM.agent.current_transaction.id
  transaction_id = StackifyRubyAPM.agent.current_transaction.id
  client_id = StackifyRubyAPM.agent.config.client_id
  device_id = StackifyRubyAPM.agent.config.device_id
  headers['X-StackifyID'] = "V1|#{transaction_id}|#{client_id}|#{device_id}" if client_id && device_id
end