-
Notifications
You must be signed in to change notification settings - Fork 16
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
Implement support for the Proxy-Upstream-Request-Attempts header #2430
Implement support for the Proxy-Upstream-Request-Attempts header #2430
Conversation
Generate changelog in
|
dialogue-core/src/main/java/com/palantir/dialogue/core/RetryingChannel.java
Outdated
Show resolved
Hide resolved
This aims to provide coordination between clients and reverse proxy servers which implement retries, allowing us to avoid multiplying out the total retry count. When dialogue is configured with more retries than a proxy, we still may retry more than we want, but not DIALOGUE_ATTEMPTS * PROXY_ATTEMPTS. The worst case scenario should be when the proxy retry attempts don't quite reach the configured dialogue retry limit, and another full round of proxy retries must be accumulated. This should be a reaosnable trade-off because it allows the calling client to be configured with a larger value as needed for stability, without multiplying all retries across the board unnecessarily. Note that when a Dialogue client receives a tcp error/closure, it can make no assumptions about proxy retry attempts, so this only applies to requests which successfully receive a response.
bcf10ba
to
1853f05
Compare
This feature functions in combination with `Proxy-Upstream-Request-Attempts` (#2430) to allow negotiation for retries to occur based on proxy configuration, without requiring clients to be updated or reconfigured.
dialogue-core/src/main/java/com/palantir/dialogue/core/RetryingChannel.java
Show resolved
Hide resolved
|
||
@Test | ||
void proxyUpstreamRequestAttempts_valid() { | ||
try (Response response = new TestResponse().withHeader(Responses.PROXY_UPSTREAM_REQUEST_ATTEMPTS, "1")) { |
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.
Thoughts on also adding some misc spaces to check that it's trim
'd?
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.
👍
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! Removed merge-when-ready
in case you wanted to make the nit test change.
Invalidated by push of 9b9cf0a
if (proxyUpstreamRequestAttempts > 1) { | ||
log.info( | ||
"Received a Proxy-Upstream-Request-Attempts response header " | ||
+ "indicating retries have already occurred", | ||
SafeArg.of("proxyUpstreamRequestAttempts", proxyUpstreamRequestAttempts)); | ||
} |
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.
I added an info-level log statement here as well
Thanks, this needs another +1 since I've pushed again! |
Released 4.5.0 |
This aims to provide coordination between clients and reverse proxy servers which implement retries, allowing us to avoid multiplying out the total retry count.
When dialogue is configured with more retries than a proxy, we still may retry more than we want, but not DIALOGUE_ATTEMPTS * PROXY_ATTEMPTS. The worst case scenario should be when the proxy retry attempts don't quite reach the configured dialogue retry limit, and another full round of proxy retries must be accumulated. This should be a reaosnable trade-off because it allows the calling client to be configured with a larger value as needed for stability, without multiplying all retries across the board unnecessarily.
Note that when a Dialogue client receives a tcp error/closure, it can make no assumptions about proxy retry attempts, so this only applies to requests which successfully receive a response.
==COMMIT_MSG==
Implement support for the Proxy-Upstream-Request-Attempts header
==COMMIT_MSG==
Note this feature is meant to be used in tandem with #2434 for flexibility