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?
I was using the
error_pagedirective with a static page serving the 5xx errors (see the snippet below) and when the backend upstream returned a5xxhttp code, I was seeing something like this in the metrics:static page serving the 5xx errors config
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
And now when my backend upstream returns a
5xxhttp code I see the following in the metrics:So I lost track of which origin upstream is returning the error since the metrics are being aggregated in the
web-error-pagesupstream.Is there a way to make this change keeping track of which origin upstream is returning a
5xxerror code?