Sha256: ba6bd745605d61932860b87449d3b809c4ce87f96ce56667993e5d21f636be2f
Contents?: true
Size: 816 Bytes
Versions: 11
Compression:
Stored size: 816 Bytes
Contents
module Goliath module Rack # Middleware to inject the tracer statistics into the response headers. # # @example # use Goliath::Rack::Tracer # class Tracer include Goliath::Rack::AsyncMiddleware def initialize(app, header_name=nil) super(app) @header_name = header_name || 'X-PostRank' end def call(env) env.trace 'trace.start' shb = super(env) env.logger.info env.trace_stats.collect{|s| s.join(':')}.join(', ') shb end def post_process(env, status, headers, body) extra = { @header_name => env.trace_stats.collect{|s| s.join(': ')}.join(', ')} env.logger.info env.trace_stats.collect{|s| s.join(':')}.join(', ') [status, headers.merge(extra), body] end end end end
Version data entries
11 entries across 11 versions & 1 rubygems