class Fbe::Middleware::Trace
def call(env)
-
(Faraday::Response)
- The response from the next middleware
Parameters:
-
env
(Faraday::Env
) -- The request environment
def call(env) entry = { method: env.method, url: env.url.to_s, started_at: Time.now } @app.call(env).on_complete do |response_env| next if !@ignores.empty? && response_env[:http_cache_trace] && (response_env[:http_cache_trace] & @ignores).size.positive? finished = Time.now duration = finished - entry[:started_at] entry[:status] = response_env.status entry[:finished_at] = finished entry[:duration] = duration @trace << entry end end