-
Notifications
You must be signed in to change notification settings - Fork 35
Make info request timeout configurable #182
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
Conversation
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.
Apart from the comment about the transport, PR LGTM.
reverseProxy := httputil.NewSingleHostReverseProxy(parsedApmServerUrl) | ||
|
||
reverseProxyTimeout := time.Duration(config.DataForwarderTimeoutSeconds) * time.Second | ||
reverseProxy.Transport = http.DefaultTransport |
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.
The caller of httputil.NewSingleHostReverseProxy(parsedApmServerUrl)
should not need to have any knowledge about internas of how the reverseProxy
is built. With this change the whole transport
of the reverseProxy
is still switched out; if any other settings (TLS, further timeouts etc) were set in the proxy they would be lost. What I originally meant, was that only the timeout
should be customized here, or even better, be passed into the abstracting httputil.NewSingleHostReverseProxy
method.
Summary
This pull request propagates the
ELASTIC_APM_DATA_FORWARDER_TIMEOUT_SECONDS
parameter to the configuration of the reverse proxy tasked with serving APM Server info requests. A error handler is also defined to enable backoff upon transaction failure. Associated tests have also been written inmain_test
.With this PR, backoff should be enabled after all failed attempts to communicate with the APM Server.
Changes
ctx
andconfig
throughhandleInfoRequest
ResponseHeaderTimeout
of the reverse proxy toELASTIC_APM_DATA_FORWARDER_TIMEOUT_SECONDS
main_test
accordinglyHow to test
Error querying version from the APM Server
should be logged.