[discuss] `checker:report_xx` is more appropriate in the log phase
Issue description
https://github.com/apache/apisix/blob/master/apisix/balancer.lua#L210
The circuit-breaker is a basic function of api gateways. Generally speaking, a fuse is divided into two parts, one is to fetch the available endpoint (or upstream), and the other is to report the node access results (whether the timeout? or connecttion status?)
In the nginx framework, the report node state is more recommended in the log phase, whereas Apache APISIX currently reports the last access result when fetching an available endpoint in the balancer phase.
Personally, I think it should be moved to the log phase.

Environment
- apisix version (cmd:
apisix version): - OS:
I think the title should be "Discuss", ;-)
I think we need to refer to how the sentinel reports upstream status.
https://github.com/alibaba/Sentinel
It is to make the report happened in time. If we only count the failure in the log phase, the operation of circuit-breaker will be delayed.
In the nginx framework, the report node state is more recommended in the log phase
No. Nginx does the same thing. Nginx counts the failure just before the retrying: https://github.com/nginx/nginx/blob/ad2b9944b012699c225d75e63aeadf61d9ce3367/src/http/ngx_http_upstream.c#L4189
If you still think the behavior is not appropriate, please contact Nginx's developers. We just follow their way.