Lax / traffic-accounting-nginx-module

Monitor the incoming and outgoing traffic metrics in realtime for NGINX
https://github.com/Lax/traffic-accounting-nginx-module
BSD 2-Clause "Simplified" License
280 stars 77 forks source link

Improve accounting for `Slow-Requests` #24

Closed Lax closed 4 years ago

Lax commented 6 years ago

There are slow-requests, no matter they're long-polling or streaming request, or just downloading large files over poor networks(high drop rate and latency).

Previous version of nginx-http-accounting-module only count requests when they have finished transfer, to be more precisely, at NGX_HTTP_LOG_PHASE phase of the request. Slow-requests don't have chance to log there transfer metrics before it's finished.

To handle this situation, a timer handler should find all the slow requests, export their metrics at the beginning of normal output process.