Traffic Jam Malfunctions

The knock, when sitting in traffic, could be the engine getting hot, and the fuel/air mixture getting lean. When the engine is cool, open the radiator cap and make sure the coolant is to the top.

Do you hear the radiator fan(s) kick on when in traffic? If they don’t, the engine may not be hot enough; or, it may be, but the engine coolant temperature sensor isn’t telling the engine that it is hot enough. Does the radiator fan come on when you turn the A/C ON?

Check the fuel pressure in idle. Is that the original fuel filter?
The engine could be missing from erratic spark; but, that’s trickier to hunt down. A crankshaft position sensor (cps) getting hot and reading wrong, is a possibility.