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

Question about nginx_vts_upstream_requests_total metric #266

Open
franciscocpg opened this issue Mar 30, 2023 · 1 comment
Open

Question about nginx_vts_upstream_requests_total metric #266

franciscocpg opened this issue Mar 30, 2023 · 1 comment

Comments

@franciscocpg
Copy link

franciscocpg commented Mar 30, 2023

I was using the error_page directive with a static page serving the 5xx errors (see the snippet below) and when the backend upstream returned a 5xx http code, I was seeing something like this in the metrics:

nginx_vts_upstream_requests_total{upstream="backend-service-1",backend="1.2.3.4:80",code="5xx"} 1
nginx_vts_upstream_requests_total{upstream="backend-service-2",backend="5.6.7.8:80",code="5xx"} 1

static page serving the 5xx errors config

error_page 500 501 502 503 504 /error/5xx.html;

location ^~ /error/ {
  root /usr/share/nginx/html;
}

Then I changed the config to use an upstream to serve the error pages instead of a static page, eg:
upstream serving the 5xx errors config

error_page 500 501 502 503 504 /error-pages/500;

location /error-pages/500 {
  proxy_pass http://web-error-pages/500;
}

And now when my backend upstream returns a 5xx http code I see the following in the metrics:

nginx_vts_upstream_requests_total{upstream="web-error-pages",backend="1.2.3.4:80",code="5xx"} 2

So I lost track of which origin upstream is returning the error since the metrics are being aggregated in the web-error-pages upstream.

Is there a way to make this change keeping track of which origin upstream is returning a 5xx error code?

@u5surf
Copy link
Collaborator

u5surf commented Mar 31, 2023

@franciscocpg
Hi,Thanks.
Could you tell me what is the detail of backend-service-1 and backend-service-2 before you change the static pages config?
We cannot see the both of upstream at all. It is necessary to figure out what happened.

After you changed to use web-error-pages, it seems to work completely fine because all the request arrived at the location of the /error-pages/500 can be proxied for the upstream of the web-error-page.

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

2 participants