Skip to content

Add retriable headers retry policy.#8187

Merged
mattklein123 merged 6 commits intoenvoyproxy:masterfrom
olegshaldybin:retriable-headers
Sep 17, 2019
Merged

Add retriable headers retry policy.#8187
mattklein123 merged 6 commits intoenvoyproxy:masterfrom
olegshaldybin:retriable-headers

Conversation

@olegshaldybin
Copy link
Copy Markdown
Contributor

Signed-off-by: Oleg Shaldibin olegsh@google.com

Description: implements the retriable headers retry policy as described in #8185.
Risk Level: low.
Testing: unit tests, manual testing.
Docs Changes: TBD.
Release Notes: new 'retriable-headers' retry policy.
Fixes #8185.

@junr03
Copy link
Copy Markdown
Member

junr03 commented Sep 10, 2019

@zuercher do you mind taking a look at this?

Copy link
Copy Markdown
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Some minor comments, but otherwise looks good.

I believe our current policy is that this needs to be reviewed by @envoyproxy/api-shepherds as well.

@zuercher zuercher added the api-review-required API review required by @envoyproxy/api-shepherds label Sep 11, 2019
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.

🐱

Caused by: #8187 was synchronize by olegshaldibin.

see: more, trace.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spell checker tagged "retrieable". The other test failure looks like a flake.

Also, we prefer not to have force-pushed changes since it can mess up github's comment tracking. We'll squash the commits on merge so you don't have to worry about keeping the history clean.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry about that: I'll have to force-push one more time b/c I already rebased my branch on upstream master. It shouldn't change the content of existing commits though, as I added new changes as separate commits.

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM but from an API perspective I would like to standardize on using HeaderMatcher for something like this. Thank you!

/wait

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we future proof this by using a repeated HeaderMatcher and related utility functions for this?

Note this change will require release notes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, didn't know about HeaderMatcher, seems like a great fit for this, thanks Matt!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any preference on how to handle retriable headers provided by the request headers? Some possibilities include:

  1. support a comma-separated list of header names and construct key-only HeaderMatcher's for them;
  2. disallow specifying them via request headers at all;
  3. provide some serialization mechanism for HeaderMatcher.

I like options 1 and 2, as 3 seems too difficult for a user to craft but don't really have strong feelings about that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah definitely not (3) IMO. I would be fine with just doing (2) for now and we can see if anyone asks for header specification later / add a TODO (assuming you don't need this).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now using HeaderMatcher, PTAL. I kept the header-specified header names but renamed the header to 'x-envoy-retriable-header-names' to make sure it's explicit. We may have a use case for specifying headers that way; at the same time I am not opposed to just removing that if it seems inconsistent.

If we're happy with the change I'll add a release note and docs.

Configured via 'retriable-headers' retry policy and 'retriable_headers'
list of headers (both can be set via config or request headers) . If the
upstream response has any of the retriable headers set, retry will be
triggered.

Signed-off-by: Oleg Shaldibin <olegsh@google.com>
Signed-off-by: Oleg Shaldibin <olegsh@google.com>
Signed-off-by: Oleg Shaldibin <olegsh@google.com>
Signed-off-by: Oleg Shaldibin <olegsh@google.com>
@olegshaldybin
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🐴 hold your horses - no failures detected, yet.

🐱

Caused by: a #8187 (comment) was created by @olegshaldibin.

see: more, trace.

mattklein123
mattklein123 previously approved these changes Sep 13, 2019
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM. Will defer to @zuercher for further review. Thank you!

@mattklein123 mattklein123 removed their assignment Sep 13, 2019
Copy link
Copy Markdown
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good!

I should have noticed this before, but we need to update docs/root/configuration/http/http_filters/router_filter.rst.

There should be an entry for retriable-headers under x-envoy-retry-on and an entry for the x-envoy-retriable-headers header that describes the header presence logic and points to the retry config for users that want more complex matching.

Signed-off-by: Oleg Shaldibin <olegsh@google.com>
Signed-off-by: Oleg Shaldibin <olegsh@google.com>
@olegshaldybin
Copy link
Copy Markdown
Contributor Author

Added docs and a release note.

Copy link
Copy Markdown
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@olegshaldybin
Copy link
Copy Markdown
Contributor Author

@mattklein123 I also need a re-approval for API (no code changes, just follow-up docs commits).

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@mattklein123 mattklein123 merged commit 81460d8 into envoyproxy:master Sep 17, 2019
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Sep 24, 2019
Configured via 'retriable-headers' retry policy and 'retriable_headers'
list of headers (both can be set via config or request headers) . If the
upstream response has any of the retriable headers set, retry will be
triggered.

Signed-off-by: Oleg Shaldibin <olegsh@google.com>
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Oct 4, 2019
Configured via 'retriable-headers' retry policy and 'retriable_headers'
list of headers (both can be set via config or request headers) . If the
upstream response has any of the retriable headers set, retry will be
triggered.

Signed-off-by: Oleg Shaldibin <olegsh@google.com>
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Oct 4, 2019
Configured via 'retriable-headers' retry policy and 'retriable_headers'
list of headers (both can be set via config or request headers) . If the
upstream response has any of the retriable headers set, retry will be
triggered.

Signed-off-by: Oleg Shaldibin <olegsh@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review-required API review required by @envoyproxy/api-shepherds

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retry policy based on response headers

4 participants