Class: SimpleApm::HttpRequest
- Inherits:
-
Object
- Object
- SimpleApm::HttpRequest
- Defined in:
- app/models/simple_apm/http_request.rb
Instance Attribute Summary collapse
-
#during ⇒ Object
Returns the value of attribute during.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#host ⇒ Object
Returns the value of attribute host.
-
#line ⇒ Object
Returns the value of attribute line.
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#request_id ⇒ Object
Returns the value of attribute request_id.
-
#started ⇒ Object
Returns the value of attribute started.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
- .create(request_id, info) ⇒ Object
- .delete_by_request_id(request_id) ⇒ Object
- .find_by_request_id(request_id) ⇒ Array<SimpleApm::HttpRequest>
- .key(request_id) ⇒ Object
Instance Method Summary collapse
-
#initialize(h, request = nil) ⇒ HttpRequest
constructor
A new instance of HttpRequest.
- #request ⇒ Object
Constructor Details
#initialize(h, request = nil) ⇒ HttpRequest
Returns a new instance of HttpRequest.
5 6 7 8 9 10 |
# File 'app/models/simple_apm/http_request.rb', line 5 def initialize(h, request = nil) h.each do |k, v| send("#{k}=", v) rescue puts "attr #{k} not set!" end @request = request end |
Instance Attribute Details
#during ⇒ Object
Returns the value of attribute during.
4 5 6 |
# File 'app/models/simple_apm/http_request.rb', line 4 def during @during end |
#filename ⇒ Object
Returns the value of attribute filename.
4 5 6 |
# File 'app/models/simple_apm/http_request.rb', line 4 def filename @filename end |
#host ⇒ Object
Returns the value of attribute host.
4 5 6 |
# File 'app/models/simple_apm/http_request.rb', line 4 def host @host end |
#line ⇒ Object
Returns the value of attribute line.
4 5 6 |
# File 'app/models/simple_apm/http_request.rb', line 4 def line @line end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'app/models/simple_apm/http_request.rb', line 4 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'app/models/simple_apm/http_request.rb', line 4 def path @path end |
#request_id ⇒ Object
Returns the value of attribute request_id.
4 5 6 |
# File 'app/models/simple_apm/http_request.rb', line 4 def request_id @request_id end |
#started ⇒ Object
Returns the value of attribute started.
4 5 6 |
# File 'app/models/simple_apm/http_request.rb', line 4 def started @started end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'app/models/simple_apm/http_request.rb', line 4 def url @url end |
Class Method Details
.create(request_id, info) ⇒ Object
26 27 28 |
# File 'app/models/simple_apm/http_request.rb', line 26 def create(request_id, info) SimpleApm::Redis.rpush(key(request_id), info.to_json) end |
.delete_by_request_id(request_id) ⇒ Object
22 23 24 |
# File 'app/models/simple_apm/http_request.rb', line 22 def delete_by_request_id(request_id) SimpleApm::Redis.del(key(request_id)) end |
.find_by_request_id(request_id) ⇒ Array<SimpleApm::HttpRequest>
18 19 20 |
# File 'app/models/simple_apm/http_request.rb', line 18 def find_by_request_id(request_id) SimpleApm::Redis.lrange(key(request_id), 0, -1).map{|x|SimpleApm::HttpRequest.new JSON.parse(x)} end |