class TCellAgent::Instrumentation::Rails::Middleware::GlobalMiddleware
Public Class Methods
new(app)
click to toggle source
# File lib/tcell_agent/rails/middleware/global_middleware.rb, line 20 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/tcell_agent/rails/middleware/global_middleware.rb, line 24 def call(env) if TCellAgent.configuration.should_intercept_requests? request = Rack::Request.new(env) TCellAgent::Instrumentation.safe_block('Setting session_id & user_id') do if request.session env[TCellAgent::Instrumentation::TCELL_ID].session_id = request.session['session_id'] env[TCellAgent::Instrumentation::TCELL_ID].user_id = TCellAgent::UserInformation.get_user_from_request(request) end end TCellAgent::Instrumentation.safe_block('Setting hmac_session_id') do if request.env[TCellAgent::Instrumentation::TCELL_ID].session_id env[TCellAgent::Instrumentation::TCELL_ID].hmac_session_id = TCellAgent::SensorEvents::Util.hmac(request.env[TCellAgent::Instrumentation::TCELL_ID].session_id) end end end @app.call(env) end