vozlt / nginx-module-vts

Nginx virtual host traffic status module
BSD 2-Clause "Simplified" License
3.24k stars 464 forks source link

precision of responseMsec #301

Open jingyuan66 opened 1 month ago

jingyuan66 commented 1 month ago

Hello! The precision of responseMsec is too small, and the response time is too short, resulting in a response time of 0ms. Is there any way to change this?

image

u5surf commented 3 weeks ago

@jingyuan66 Hi, Thanks submit the issue. Unfortunately the upstream responseMsec has been depended by nginx upstream module, its precision cannot change any way from this module. https://github.com/nginx/nginx/blob/f45c2707ea1bf6fde3bd0c045cc4a63cdc4a966a/src/http/ngx_http_upstream.c#L5796-L5804

jingyuan66 commented 3 weeks ago

Thank you for the quick response and the information on the fixed precision of the nginx upstream module for response times. I also want to explore another way to obtain the response time data. I considering using following prometheus query: sum(rate(nginx_vts_upstream_response_seconds_total[1m])) by (backend) * 1000 / sum(rate(nginx_vts_upstream_requests_total[1m])) by (backend) this query calculates the average response time in milliseconds for each backend by summing the response times and dividing by request count over the past minute. Would this effectively provide the precision I need? Thank you again for your help!