# File src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb, line 61
    def begin_rack_request(rack_env)
      reporter = rack_env['union_station_hooks']
      return reporter if reporter

      # PASSENGER_TXN_ID may be nil here even if Union Station support is
      # enabled. For example, if the user tried to access the application
      # process directly through its private HTTP socket.
      txn_id = rack_env['PASSENGER_TXN_ID']
      return nil if !txn_id

      # Workaround for Ruby < 2.1 support where there is no function for querying
      # the monotonic time.
      delta_monotonic_env = rack_env['PASSENGER_DELTA_MONOTONIC']
      set_delta_monotonic(delta_monotonic_env.to_i) if delta_monotonic_env

      reporter = RequestReporter.new(context, txn_id, app_group_name, key)
      return if reporter.null?

      rack_env['union_station_hooks'] = reporter
      Thread.current[:union_station_hooks] = reporter
      reporter.log_request_begin
      reporter.log_gc_stats_on_request_begin
      reporter
    end