Stream metrics

Richa Gaur richagaur586 at gmail.com
Wed Jan 12 18:19:58 UTC 2022


Hello,

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
picture.

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.  Basically, collect metric for each read/write event from
the client.

Any help would be appreciated.

Thanks and Regards,
Richa Gaur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20220112/74f33998/attachment.htm>


More information about the nginx-devel mailing list