Systems, methods, and apparatuses provide a scalable framework for analyzing queuing and transient congestion in network switches. The system reports which flows contributed to the queue buildup and enables direct per-packet action in the data plane to prevent transient congestion. The system may be configured to analyze queuing in legacy network switches.