Class: Logtail::Integrations::Rack::HTTPRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/logtail-rack/http_request.rb

Overview

Note:

This event should be installed automatically through integrations, such as the Integrations::ActionController::LogSubscriber integration.

The HTTP server request event tracks incoming HTTP requests to your HTTP server. Such as unicorn, webrick, puma, etc.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ HTTPRequest

Returns a new instance of HTTPRequest.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/logtail-rack/http_request.rb', line 15

def initialize(attributes)
  @body = attributes[:body]
  @content_length = attributes[:content_length]
  @headers = attributes[:headers]
  @host = attributes[:host]
  @method = attributes[:method]
  @path = attributes[:path]
  @port = attributes[:port]
  @query_string = attributes[:query_string]
  @scheme = attributes[:scheme]
  @request_id = attributes[:request_id]
  @service_name = attributes[:service_name]

  if @headers
    @headers_json = Util::Encoding.force_utf8_encoding(@headers).to_json
  end
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def body
  @body
end

#content_lengthObject (readonly)

Returns the value of attribute content_length.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def content_length
  @content_length
end

#headersObject (readonly)

Returns the value of attribute headers.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def headers
  @headers
end

#headers_jsonObject (readonly)

Returns the value of attribute headers_json.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def headers_json
  @headers_json
end

#hostObject (readonly)

Returns the value of attribute host.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def host
  @host
end

#methodObject (readonly)

Returns the value of attribute method.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def method
  @method
end

#pathObject (readonly)

Returns the value of attribute path.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def path
  @path
end

#portObject (readonly)

Returns the value of attribute port.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def port
  @port
end

#query_stringObject (readonly)

Returns the value of attribute query_string.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def query_string
  @query_string
end

#request_idObject (readonly)

Returns the value of attribute request_id.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def request_id
  @request_id
end

#schemeObject (readonly)

Returns the value of attribute scheme.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def scheme
  @scheme
end

#service_nameObject (readonly)

Returns the value of attribute service_name.



12
13
14
# File 'lib/logtail-rack/http_request.rb', line 12

def service_name
  @service_name
end

Instance Method Details

#messageObject



33
34
35
# File 'lib/logtail-rack/http_request.rb', line 33

def message
  'Started %s "%s"' % [method, path]
end