class TCellAgent::Instrumentation::Rails::Middleware::BodyFilterMiddleware

Public Class Methods

new(app) click to toggle source
# File lib/tcell_agent/rails/middleware/body_filter_middleware.rb, line 19
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/tcell_agent/rails/middleware/body_filter_middleware.rb, line 23
def call(env)
  start_time = (Time.now.to_f * 1000).to_i

  response = @app.call(env)

  if TCellAgent.configuration.should_intercept_requests?
    TCellAgent::Instrumentation.safe_block('Handling reporting metrics') do
      response_time = (Time.now.to_f * 1000).to_i - start_time
      TCellAgent.report_metrics(response_time, env[TCellAgent::Instrumentation::TCELL_ID])
    end
  end

  response
end