Instrumentation: Proxy status code correction and various improvements (#47473) (#47903)

For a proxied request, e.g. Grafana's datasource or plugin proxy:
If the request is cancelled, e.g. from the browser, the HTTP status code is
now 499 Client closed request instead of 502 Bad gateway.
If the request times out, e.g. takes longer time than allowed, the HTTP status
code is now 504 Gateway timeout instead of 502 Bad gateway.
This also means that request metrics and logs will get their status codes
adjusted according to above.

Fixes #46337
Fixes #46338

(cherry picked from commit 4bc582570e)

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2022-04-19 14:41:57 -04:00
committed by GitHub
parent 39cab9c066
commit aa5bc10bcf
7 changed files with 387 additions and 80 deletions
-2
View File
@@ -455,8 +455,6 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
assert.Equal(t, "http://host/root/path/to/folder/", req.URL.String())
assert.Empty(t, req.Header.Get("Origin"))
assert.Empty(t, req.Header.Get("Referer"))
assert.Equal(t, "stillthere", req.Header.Get("X-Canary"))
})