Class: Goliath::Rack::Tracer
- Inherits:
-
Object
- Object
- Goliath::Rack::Tracer
- Includes:
- AsyncMiddleware
- Defined in:
- lib/goliath/rack/tracer.rb
Overview
Middleware to inject the tracer statistics into the response headers.
Instance Method Summary (collapse)
Methods included from AsyncMiddleware
Constructor Details
This class inherits a constructor from Goliath::Rack::AsyncMiddleware
Instance Method Details
- (Object) call(env)
11 12 13 14 15 16 |
# File 'lib/goliath/rack/tracer.rb', line 11 def call(env) env.trace 'trace.start' shb = super(env) env.logger.info env.trace_stats.collect{|s| s.join(':')}.join(', ') shb end |
- (Object) post_process(env, status, headers, body)
18 19 20 21 |
# File 'lib/goliath/rack/tracer.rb', line 18 def post_process(env, status, headers, body) extra = { 'X-PostRank' => env.trace_stats.collect{|s| s.join(': ')}.join(', ')} [status, headers.merge(extra), body] end |