Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request help: Distinguish the source (upstream or apisix) of the status code, whether it can be extended to all the status code #3963

Closed
fukiki opened this issue Apr 1, 2021 · 14 comments
Assignees

Comments

@fukiki
Copy link
Contributor

fukiki commented Apr 1, 2021

Issue description

There was a discussion earlier about How to distinguish the source of these response status codes :
Issue 2501 and PR 2817.

The conclusion is that: In the response header of the request, through the response header of X-APISIX-Upstream-Status, we can effectively identify the source of the 5xx status code.

About this, I have a question: Why only distinguish 5xx status codes?

In some scenarios, the requirement may be how to distinguish the source of status codes 4xx.

In addition to this, We can rewrite the upstream status codes by APISIX's response-rewrite plugin. In this case, if we can't distinguish the source of the status code,upstream or apisix,it can’t quickly help us determine the problem.

Therefore, I would like to ask for some opinions of the community:
Distinguish the source (upstream or apisix) of the status code, whether it can be extended to all the status code,not only 5xx.

@Firstsawyou
Copy link
Contributor

Why only distinguish 5xx status codes?

There are many factors that cause 5xx status codes. We need to distinguish their sources and narrow the scope of the problem. The 4xx status codes are caused by client requests that do not conform to semantic specifications and have obvious prompt information.

@fukiki
Copy link
Contributor Author

fukiki commented Apr 1, 2021

Why only distinguish 5xx status codes?

There are many factors that cause 5xx status codes. We need to distinguish their sources and narrow the scope of the problem. The 4xx status codes are caused by client requests that do not conform to semantic specifications and have obvious prompt information.

The 4xx status codes are not only caused by client requests, such as the following example:
apisix2

@Firstsawyou
Copy link
Contributor

The 4xx status codes are not only caused by client requests, such as the following example:

This is more intuitive to know the cause of the problem. Maybe we need to support distinguishing the source of 4xx status codes.

@fukiki
Copy link
Contributor Author

fukiki commented Apr 1, 2021

This is more intuitive to know the cause of the problem. Maybe we need to support distinguishing the source of 4xx status codes.

In some special cases, other status codes may have similar problems.
Support distinguishing the source of all status codes, will be more generic.

@tokers
Copy link
Contributor

tokers commented Apr 1, 2021

Actually, there are a bunch of headers can be added for the debugging purpose:

  • X-Upstream-Status, the status code returned by upstream;
  • X-Upstream-Addr, the upstream endpoint address;
  • ....

Of course, some information is sensitive, and maybe a switch should be introduced to show these data.

@fukiki
Copy link
Contributor Author

fukiki commented Apr 2, 2021

Actually, there are a bunch of headers can be added for the debugging purpose:

  • X-Upstream-Status, the status code returned by upstream;
  • X-Upstream-Addr, the upstream endpoint address;
  • ....

Of course, some information is sensitive, and maybe a switch should be introduced to show these data.

@tokers That's a good suggestion.

@imjoey
Copy link
Member

imjoey commented Apr 2, 2021

@fukiki @Firstsawyou @tokers

As the X-APISIX-Upstream-Status is already supported, so I was wondering that is that possible for us to reach a conclusion that adding X-APISIX-Upstream-Status back to the response header for all cases, under the control of a switch.

Thanks.

@Firstsawyou
Copy link
Contributor

@fukiki @Firstsawyou @tokers

As the X-APISIX-Upstream-Status is already supported, so I was wondering that is that possible for us to reach a conclusion that adding X-APISIX-Upstream-Status back to the response header for all cases, under the control of a switch.

Thanks.

This looks good, I think it is ok.

@tokers
Copy link
Contributor

tokers commented Apr 3, 2021

We can send a proposal to the mail list, who wants to do this?

@imjoey
Copy link
Member

imjoey commented Apr 4, 2021

We can send a proposal to the mail list, who wants to do this?

Hi @fukiki , is that possible for you to send a proposal email to the dev mail list for further discussion? We actually need more opinions. Thanks.

@fukiki
Copy link
Contributor Author

fukiki commented Apr 6, 2021

@tokers @imjoey I will send a proposal email to the dev mail list for further discussion.

@gxthrj
Copy link
Contributor

gxthrj commented Apr 22, 2021

I think recording all non-2xx requests and provide a similar header of x-upstream-status is better.

@spacewander
Copy link
Member

@liangliang4ward
Would you like to submit a PR for it?

@liangliang4ward
Copy link
Contributor

I think recording all non-2xx requests and provide a similar header of x-upstream-status is better.

ok, let me try do this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants