Class: RequestQueueTimeMiddleware
- Inherits:
-
Object
- Object
- RequestQueueTimeMiddleware
- Defined in:
- lib/rack/request_queue_time_middleware.rb
Overview
Measures the queue time (= time between receiving the request in downstream load balancer and starting request in ruby process)
Constant Summary collapse
- ENV_KEY =
'rack.request_queue_time'
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, statsd:, process: Process) ⇒ RequestQueueTimeMiddleware
constructor
A new instance of RequestQueueTimeMiddleware.
Constructor Details
#initialize(app, statsd:, process: Process) ⇒ RequestQueueTimeMiddleware
Returns a new instance of RequestQueueTimeMiddleware.
8 9 10 11 12 |
# File 'lib/rack/request_queue_time_middleware.rb', line 8 def initialize(app, statsd:, process: Process) @app = app @statsd = statsd @process = process end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/rack/request_queue_time_middleware.rb', line 14 def call(env) queue_time = measure_queue_time(env) report_queue_time(queue_time) env[ENV_KEY] = queue_time @app.call(env) end |