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

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
This commit is contained in:
Marcus Efraimsson
2022-04-11 13:17:08 +02:00
committed by GitHub
parent c0104db72d
commit 4bc582570e
7 changed files with 387 additions and 80 deletions

View File

@ -456,8 +456,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"))
})