Class: StackifyRubyAPM::Context::Response Private

Inherits:
Object
  • Object
show all
Includes:
NaivelyHashable
Defined in:
lib/stackify_apm/context/response.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from NaivelyHashable

#naively_hashable?, #to_h

Constructor Details

#initialize(status_code, headers: {}, headers_sent: true, finished: true) ⇒ Response

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Response.



9
10
11
12
13
14
15
16
17
18
19
20
# 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

Instance Attribute Details

#finishedObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
# File 'lib/stackify_apm/context/response.rb', line 22

def finished
  @finished
end

#headersObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
# File 'lib/stackify_apm/context/response.rb', line 22

def headers
  @headers
end

#headers_sentObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
# File 'lib/stackify_apm/context/response.rb', line 22

def headers_sent
  @headers_sent
end

#status_codeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
# File 'lib/stackify_apm/context/response.rb', line 22

def status_code
  @status_code
end

Instance Method Details

#make_xstackify_id_header(headers) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
27
28
29
30
# 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