Class: SimpleApm::Request

Inherits:
Object
  • Object
show all
Defined in:
app/models/simple_apm/request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(h) ⇒ Request

Returns a new instance of Request.



9
10
11
12
13
# File 'app/models/simple_apm/request.rb', line 9

def initialize(h)
  h.each do |k, v|
    send("#{k}=", v) rescue puts "attr #{k} not set!"
  end
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def action
  @action
end

#action_nameObject

Returns the value of attribute action_name.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def action_name
  @action_name
end

#completed_memoryObject

Returns the value of attribute completed_memory.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def completed_memory
  @completed_memory
end

#controllerObject

Returns the value of attribute controller.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def controller
  @controller
end

#db_runtimeObject

Returns the value of attribute db_runtime.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def db_runtime
  @db_runtime
end

#duringObject

Returns the value of attribute during.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def during
  @during
end

#exceptionObject

Returns the value of attribute exception.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def exception
  @exception
end

#formatObject

Returns the value of attribute format.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def format
  @format
end

#hostObject

Returns the value of attribute host.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def host
  @host
end

#memory_duringObject

Returns the value of attribute memory_during.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def memory_during
  @memory_during
end

#methodObject

Returns the value of attribute method.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def method
  @method
end

#net_http_duringObject

Returns the value of attribute net_http_during.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def net_http_during
  @net_http_during
end

#remote_addrObject

Returns the value of attribute remote_addr.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def remote_addr
  @remote_addr
end

#request_idObject

Returns the value of attribute request_id.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def request_id
  @request_id
end

#startedObject

Returns the value of attribute started.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def started
  @started
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def status
  @status
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def url
  @url
end

#view_runtimeObject

Returns the value of attribute view_runtime.



4
5
6
# File 'app/models/simple_apm/request.rb', line 4

def view_runtime
  @view_runtime
end

Class Method Details

.create(h) ⇒ Object



30
31
32
# File 'app/models/simple_apm/request.rb', line 30

def create(h)
  SimpleApm::Redis.hmset key, h['request_id'], h.to_json
end

.find(id) ⇒ Object



26
27
28
# File 'app/models/simple_apm/request.rb', line 26

def find(id)
  SimpleApm::Request.new JSON.parse(SimpleApm::Redis.hget(key, id))
end

.keyObject



34
35
36
# File 'app/models/simple_apm/request.rb', line 34

def key
  SimpleApm::RedisKey['requests']
end

Instance Method Details

#net_http_requestsObject



15
16
17
# File 'app/models/simple_apm/request.rb', line 15

def net_http_requests
  @requests ||= SimpleApm::HttpRequest.find_by_request_id(request_id)
end

#sqlsObject



19
20
21
# File 'app/models/simple_apm/request.rb', line 19

def sqls
  @sqls ||= SimpleApm::Sql.find_by_request_id(request_id)
end