You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/11/16 04:56:14 UTC

[GitHub] [apisix] tzssangglass commented on issue #5512: bug: The kafka-logger plugin cannot collect the value of each nginx built-in variable correctly

tzssangglass commented on issue #5512:
URL: https://github.com/apache/apisix/issues/5512#issuecomment-969859497


   here is my test:
   
   ```
     {
       "server_protocol": "HTTP/1.1",
       "@timestamp": "2021-11-16T12:28:39+08:00",
       "upstream_bytes_received": "528",
       "server_name": "_",
       "upstream_http_content_type": "application/json",
       "upstream_status": "200",
       "request_completion": "OK",
       "body_bytes_sent": "298",
       "upstream_addr": "198.18.2.225:80",
       "msec": "1637036919.270",
       "server_port": "9080",
       "route_id": "1",
       "upstream_uri": "",
       "request_method": "GET",
       "request_time": 0.426,
       "status": 200,
       "upstream_response_time": 0.426,
       "upstream_header_time": 0.426,
       "upstream_connect_time": 0.001,
       "upstream_scheme": "http",
       "bytes_sent": 526,
       "realip_remote_addr": "127.0.0.1",
       "remote_addr": "127.0.0.1",
       "host": "127.0.0.1",
       "uri": "/get",
       "http_user_agent": "curl/7.64.1",
       "request_uri": "/get",
       "request_length": 81,
       "upstream_http_content_length": "298",
       "scheme": "http",
       "upstream_host": "127.0.0.1:9080"
     }
   ```
   
   same as you, you can see that some of the data is not normal.
   
   I don't know why `request_time` , `upstream_response_time` and `upstream_connect_time` are 0 in your case.
   
   however, `request_time` and `upstream_response_time` may not be accurate, see https://stackoverflow.com/questions/53978695/how-can-request-time-be-less-than-upstream-response-time-in-nginx and https://github.com/apache/apisix/issues/5146
   
   if you want to get exact `upstream_response_time `, take a look at: https://github.com/openresty/openresty/issues/206#issuecomment-260101217
   
   these variables are not inherently accurate, I don't think this is a bug in the kafka-logger plugin, you need to do some calculations, like: https://github.com/apache/apisix/blob/718eb4b21efb2e640939f864441c5e84b7c46cad/apisix/plugins/prometheus/exporter.lua#L147-L164
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org