# File lib/new_relic/agent/commands/xray_session_collection.rb, line 138
        def remove_session_by_id(id)
          session = @sessions_lock.synchronize { @sessions.delete(id) }

          if session
            NewRelic::Agent.logger.debug("Removing X-Ray session #{session.inspect}")
            NewRelic::Agent.increment_metric("Supportability/XraySessions/Stops")

            if session.run_profiler?
              @backtrace_service.unsubscribe(session.key_transaction_name)
            end
            session.deactivate
          end
        end