Class: TCellAgent::Instrumentation::Rails::Middleware::BodyFilterMiddleware
- Inherits:
-
Object
- Object
- TCellAgent::Instrumentation::Rails::Middleware::BodyFilterMiddleware
- Defined in:
- lib/tcell_agent/rails/middleware/body_filter_middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ BodyFilterMiddleware
constructor
A new instance of BodyFilterMiddleware.
Constructor Details
#initialize(app) ⇒ BodyFilterMiddleware
Returns a new instance of BodyFilterMiddleware.
19 20 21 |
# File 'lib/tcell_agent/rails/middleware/body_filter_middleware.rb', line 19 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# 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 |