{"action":"created","issue":{"url":"https://api.github.com/repos/vozlt/nginx-module-vts/issues/67","repository_url":"https://api.github.com/repos/vozlt/nginx-module-vts","labels_url":"https://api.github.com/repos/vozlt/nginx-module-vts/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/vozlt/nginx-module-vts/issues/67/comments","events_url":"https://api.github.com/repos/vozlt/nginx-module-vts/issues/67/events","html_url":"https://github.com/vozlt/nginx-module-vts/pull/67","id":201336209,"number":67,"title":"Fix request_time section","user":{"login":"lucasrodcosta","id":2574399,"avatar_url":"https://avatars.githubusercontent.com/u/2574399?v=3","gravatar_id":"","url":"https://api.github.com/users/lucasrodcosta","html_url":"https://github.com/lucasrodcosta","followers_url":"https://api.github.com/users/lucasrodcosta/followers","following_url":"https://api.github.com/users/lucasrodcosta/following{/other_user}","gists_url":"https://api.github.com/users/lucasrodcosta/gists{/gist_id}","starred_url":"https://api.github.com/users/lucasrodcosta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucasrodcosta/subscriptions","organizations_url":"https://api.github.com/users/lucasrodcosta/orgs","repos_url":"https://api.github.com/users/lucasrodcosta/repos","events_url":"https://api.github.com/users/lucasrodcosta/events{/privacy}","received_events_url":"https://api.github.com/users/lucasrodcosta/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-01-17T16:27:46Z","updated_at":"2017-02-07T06:52:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/vozlt/nginx-module-vts/pulls/67","html_url":"https://github.com/vozlt/nginx-module-vts/pull/67","diff_url":"https://github.com/vozlt/nginx-module-vts/pull/67.diff","patch_url":"https://github.com/vozlt/nginx-module-vts/pull/67.patch"},"body":"The current implementation calculates the average request-time using the following formula:\r\n\r\n```\r\nnew_average = (new_value + old_average) / 2\r\n```\r\n\r\nHowever, this approach is wrong, because it assumes that `new_value` has the same weight as all previous values used to compute the `old_average`.\r\n\r\nAs can be seen [here](http://math.stackexchange.com/a/1153800) and [here](http://math.stackexchange.com/a/957376), the correct approach to calculate the average without store all request-times is:\r\n\r\n```\r\nnew_average = old_average + ((new_value - old_average) / new_size)\r\n```"},"comment":{"url":"https://api.github.com/repos/vozlt/nginx-module-vts/issues/comments/277916579","html_url":"https://github.com/vozlt/nginx-module-vts/pull/67#issuecomment-277916579","issue_url":"https://api.github.com/repos/vozlt/nginx-module-vts/issues/67","id":277916579,"user":{"login":"vozlt","id":3648408,"avatar_url":"https://avatars.githubusercontent.com/u/3648408?v=3","gravatar_id":"","url":"https://api.github.com/users/vozlt","html_url":"https://github.com/vozlt","followers_url":"https://api.github.com/users/vozlt/followers","following_url":"https://api.github.com/users/vozlt/following{/other_user}","gists_url":"https://api.github.com/users/vozlt/gists{/gist_id}","starred_url":"https://api.github.com/users/vozlt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vozlt/subscriptions","organizations_url":"https://api.github.com/users/vozlt/orgs","repos_url":"https://api.github.com/users/vozlt/repos","events_url":"https://api.github.com/users/vozlt/events{/privacy}","received_events_url":"https://api.github.com/users/vozlt/received_events","type":"User","site_admin":false},"created_at":"2017-02-07T06:52:57Z","updated_at":"2017-02-07T06:52:57Z","body":"I added that feature as mentioned above.\r\nI haven't much test yet. 😆 \r\nBy default, It use the 63 of recent values to compute.\r\nIt is a static buffer size.\r\nSo If you want to change it, you must change the below file.\r\n\r\n`$ vi src/ngx_http_vhost_traffic_status_node.h`\r\n```C\r\n  9 \r\n 10 #define NGX_HTTP_VHOST_TRAFFIC_STATUS_DEFAULT_QUEUE_LEN  ...\r\n 11 \r\n```\r\nLatest commit: https://github.com/vozlt/nginx-module-vts/commit/468f6e401647f314aa32069f0540588d1e5621a4"}}
{"actor":{"display_login":"vozlt"}}