-
Notifications
You must be signed in to change notification settings - Fork 107
Return 499 http code instead of 502 when client disconnect during a render query with graphite proxying #1821
Conversation
…orwarded to graphite, return http code 499 instead of default 502 by implementing a custom proxy error handler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I was thinking, is it possible that tsdb-gw itself was disconnecting and not the actual client? |
that's definitely possible. at least that would explain why we have so many of these disconnects on various different instances, it would be weird if all our users behaved that way. |
I have just verified this PR using this simple test program:
before this PRMT logs
ngrep sniff
With this PR appliedMT output
ngrep sniff
So, it seems to work as expected. "status code 499" isn't the most useful status message, and redundant, but given that no client will actually see it, it's fine. |
PS. nice work @fkaleo ! |
@Dieterbe your thoughts on #1821 (comment) ? |
FWIW, we see these too and don't use tsdb-gw. I've traced it down to auto refreshing grafana dashboards. If the dashboard is set to refresh every 5s (for example) but some of the queries take longer, grafana cancels the request and we get a 502. |
Seems tsdbgw uses http.DefaultTransport when it creates the proxy to MT
timeouts in go are quite complicated - it's hard to even figure out which setting controls exactly what - see e.g. https://blog.cloudflare.com/the-complete-guide-to-golang-net-http-timeouts/ which i'm not sure corresponds to our go version |
Thanks! That's what I suspected :) |
If the client disconnects while processing a query that needs to be forwarded to graphite, return http code 499 instead of default 502 by implementing a custom proxy error handler.
Fix #1820