I am using nginx as an L4 load balancer. I need to expose some stream level
metrics like throughput etc. I am using nginx-module-stream-sts
<https://github.com/vozlt/nginx-module-stream-sts> for calculating metrics.
However, this module operates at nginx-stream-log-phase which is called
just before closing the connection. In case, if the underlying connection
is persistent and several requests are being made on the same connection,
the metrics are calculated at the end which does not depict the true
I tried looking at the stream-module code and based on preliminary
observations it looks like the stream phases are called for each stream
session and not for each tcp request (analogous to http request). So, even
if I register the handler at an earlier phase, let's say
nginx-stream-content-phase, it would be called only once in the connection
lifecycle instead of being called for every request.
Please let me know if my understanding is correct and if there is any
mechanism by which I can calculate metrics for each TCP request and show
real time data.
Any help would be appreciated.
Thanks and Regards,