Goal: control consumption of proxy.
I have a python code that connects to a third party API through a proxy.
The difficulty is that the script is multi-threaded (threads are launched through multiprocessing.Process), each thread has an ID. I need to understand how much each thread consumes traffic.
I tried to save the PID for each thread and catch traffic through linux nethogs, but the data is incorrect, part of packets are lost and the traffic does not converge with the real.
Tell me, please, can there be a more concise solution for monitoring traffic consumption?