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 2020/10/23 03:37:21 UTC

[GitHub] [apisix] Firstsawyou opened a new issue #2501: discuss: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Firstsawyou opened a new issue #2501:
URL: https://github.com/apache/apisix/issues/2501


   ### Issue description
   
   When our http request gets an error status code `5XX`, for example: 500. How do we know if this status comes from `upstream` or `apisix`.
   
   To know the source of the error status code, I think that in the response phase (`header_filter`), we can determine that the upstream response code is equal to `5XX`. When it is equal to `5XX`, we can set relevant headers in the response header to achieve our goal.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] tokers commented on issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #2501:
URL: https://github.com/apache/apisix/issues/2501#issuecomment-714889507


   We may resort to the logging or tracing to determine this difference.
   
   The way you described is more like a debugging way, maybe it can be expanded to support more demands.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] spacewander commented on issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #2501:
URL: https://github.com/apache/apisix/issues/2501#issuecomment-715063075


   Why not use `$upstream_status`?


----------------------------------------------------------------
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.

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



[GitHub] [apisix] moonming commented on issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
moonming commented on issue #2501:
URL: https://github.com/apache/apisix/issues/2501#issuecomment-727541330


   any update?


----------------------------------------------------------------
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.

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



[GitHub] [apisix] Firstsawyou commented on issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on issue #2501:
URL: https://github.com/apache/apisix/issues/2501#issuecomment-715125015


   > We may resort to the logging or tracing to determine this difference.
   > 
   > The way you described is more like a debugging way, maybe it can be expanded to support more demands.
   
   I think if we can know the source of the abnormal request (`upstream` or `apisix`) directly through the http response header, then we don't need to track the request or check the logger. For example: an http request returns a 500 status code. If relevant information is recorded in the response header, we can directly know where the problem occurred, and there is no need to track or view the record to determine the problem.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] Firstsawyou commented on issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on issue #2501:
URL: https://github.com/apache/apisix/issues/2501#issuecomment-728689217


   assigned to me.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] spacewander closed issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #2501:
URL: https://github.com/apache/apisix/issues/2501


   


----------------------------------------------------------------
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.

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



[GitHub] [apisix] gxthrj commented on issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
gxthrj commented on issue #2501:
URL: https://github.com/apache/apisix/issues/2501#issuecomment-716373824


   I agree with this idea, it will speed up the speed of finding problems out, no need to check the log.
   We can add `x-apisix-upstream-*` in the response header.
   e.g.
   
   When upstream returns 5xx, we get a response like this
   ```
   < HTTP/1.1 5xx *********
   < Date: xxx
   < Content-Type: application/json; charset=UTF-8
   < Connection: keep-alive
   < Server: apisix/1.5.0
   < X-Apisix-Upstream-address: 10.10.10.10:8080
   < Via: apisix/1.5.0
   ```
   When upstream times out, we can get a response like this
   ```
   < HTTP/1.1 504 Gateway Time-out
   < Date: xxx
   < Content-Type: application/json; charset=UTF-8
   < Connection: keep-alive
   < Server: apisix/1.5.0
   < X-Apisix-Upstream-Latency: 30002
   < Via: apisix/1.5.0
   ```


----------------------------------------------------------------
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.

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



[GitHub] [apisix] Firstsawyou commented on issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on issue #2501:
URL: https://github.com/apache/apisix/issues/2501#issuecomment-715134488


   > Why not use `$upstream_status`?
   
   The meaning expressed in the description is to use `$upstream_status`, which may be a bit abstract in the description. ^ . ^


----------------------------------------------------------------
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.

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



[GitHub] [apisix] Firstsawyou commented on issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on issue #2501:
URL: https://github.com/apache/apisix/issues/2501#issuecomment-728689118


   I will submit a PR later to solve this problem.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] idbeta commented on issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
idbeta commented on issue #2501:
URL: https://github.com/apache/apisix/issues/2501#issuecomment-719157283


   I agree with the idea of adding a new field in the response header.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] membphis commented on issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #2501:
URL: https://github.com/apache/apisix/issues/2501#issuecomment-717998727


   agree +1 ^_^


----------------------------------------------------------------
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.

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



[GitHub] [apisix] tokers commented on issue #2501: [discuss]: How to distinguish whether the 5xx status code (eg 500) comes from upstream or apisix

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #2501:
URL: https://github.com/apache/apisix/issues/2501#issuecomment-715220523


   > > We may resort to the logging or tracing to determine this difference.
   > > The way you described is more like a debugging way, maybe it can be expanded to support more demands.
   > 
   > I think if we can know the source of the abnormal request (`upstream` or `apisix`) directly through the http response header, then we don't need to track the request or check the logger. For example: an http request returns a 500 status code. If relevant information is recorded in the response header, we can directly know where the problem occurred, and there is no need to track or view the record to determine the problem.
   
   The example you took is a relatively simple situation, problem like timeout is more sophisticated, you cannot know the cause oftimeout (connect, SSL handshake, read or write) without extra information in HTTP headers, in such a case, you still have to use other tools. Or we have to record enough messages in HTTP headers, which is heavy. At least we cannot enable this feature for all requests, maybe a switch is needed.


----------------------------------------------------------------
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.

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