module TCellAgent::Instrumentation::RouteId

Public Class Methods

update_context(env, parameters, route) click to toggle source
# File lib/tcell_agent/rails/routes/route_id.rb, line 4
def self.update_context(env, parameters, route)
  tcell_context = env[TCellAgent::Instrumentation::TCELL_ID]

  return unless route && tcell_context

  tcell_context.path_parameters = parameters
  route_path = route.path.spec.to_s
  grape_mount_endpoint = nil

  grape_mount_endpoint = route_path if TCellAgent::Instrumentation.grape_route?(route)

  if grape_mount_endpoint
    tcell_context.grape_mount_endpoint = grape_mount_endpoint

  else
    tcell_context.route_id = TCellAgent::SensorEvents::Util.calculate_route_id(
      tcell_context.request_method, route_path
    )
  end
end