Skip to content
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

extenstions: retry predicate - omit_canary_hosts #7230

Merged
merged 7 commits into from
Jun 20, 2019

Conversation

sriduth
Copy link
Contributor

@sriduth sriduth commented Jun 11, 2019

Description: Created a new retry predicate that will reject canary hosts when selecting a host to retry a failure.
Risk Level: Low
Testing: Unit Tests added, manual testing done (1 canary host, 1 non canary host)
Docs Changes: Added brief description in docs/root/intro/arch_overview/http_connection_management.rst
Release Notes: N/A
[Optional Fixes #Issue] Fixes #7203
[Optional Deprecated:]

Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! This seems like exactly what I was thinking, just have some comments about style/conventions.

You'll also want to fix DCO (https://github.com/envoyproxy/envoy/blob/master/CONTRIBUTING.md#fixing-dco) and format the files using tools/check_format.py fix.

@@ -60,6 +60,9 @@ can be used to modify this behavior, and they fall into two categories:
* *envoy.retry_host_predicates.previous_hosts*: This will keep track of previously attempted hosts, and rejects
hosts that have already been attempted.

* *community.retry_host_predicates.omit_canary_hosts*: This will ensure that a retry will always be done on
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this extension lives in the envoy repo we'll want to prefix the name with envoy like all the other extensions

std::string name() override { return RetryHostPredicateValues::get().OmitCanaryHostsPredicate; }

ProtobufTypes::MessagePtr createEmptyConfigProto() override {
return ProtobufTypes::MessagePtr{new Envoy::ProtobufWkt::Empty()};
Copy link
Contributor

Choose a reason for hiding this comment

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

Use std::make_unique instead of explicit new

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! I got started on this PR by copying the sources of the previous_hosts extensions, can I make this change there also?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, I wouldn't mind the cleanup

namespace Envoy {
class OmitCanaryHostsRetryPredicate : public Upstream::RetryHostPredicate {
public:
OmitCanaryHostsRetryPredicate() {}
Copy link
Contributor

Choose a reason for hiding this comment

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

this does nothing, you can just remove it

sriduth added 2 commits June 13, 2019 10:48
…nvoyproxy#7203)

In case a user wants to deploy a new change, this can help in cases
where any failure in the canary downstream is retried in a stable
downstream.

Signed-off-by: Sriduth Jayhari <[email protected]>
…anary_hosts` retry predicate in

docs/root/intro/arch_overview/http_connection_management.rst

Signed-off-by: Sriduth Jayhari <[email protected]>
@sriduth sriduth force-pushed the feature/retry-on-non-canary-host branch from e6e7f4e to 06e27c4 Compare June 13, 2019 06:45
* Format code
* Remove empty OmitCanaryHostsRetryPredicate constructor
* Cleanup: Use std::unique_ptr to make empty proto config for all host based predicates
* Fix extenstion name in unit test and well_known_names.h

Signed-off-by: Sriduth Jayhari <[email protected]>
@sriduth sriduth force-pushed the feature/retry-on-non-canary-host branch from 06e27c4 to 266f00f Compare June 13, 2019 06:55
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Nice this looks pretty good. Just a few minor comments. Could you add a release note for this as well?

source/extensions/retry/host/omit_canary_hosts/config.h Outdated Show resolved Hide resolved
* Added release note
* Improve documentation
* return unique_ptr of Envoy::ProtobufWkt::Empty instead of wrapping with
  a message ptr in createEmptyProto (also added for previous hosts predicate)

Signed-off-by: Sriduth Jayhari <[email protected]>
@snowp
Copy link
Contributor

snowp commented Jun 18, 2019

This looks good to me. Could you merge master and see if CI is okay? You can also move this out of Draft mode at this point.

@snowp snowp added the waiting label Jun 18, 2019
@sriduth sriduth marked this pull request as ready for review June 18, 2019 16:47
@snowp
Copy link
Contributor

snowp commented Jun 18, 2019

Seems like there's a CI failure

/wait

@sriduth sriduth requested a review from lizan as a code owner June 19, 2019 01:56
@sriduth sriduth force-pushed the feature/retry-on-non-canary-host branch from 2ba14cd to 3d1bc6b Compare June 19, 2019 01:58
@sriduth
Copy link
Contributor Author

sriduth commented Jun 19, 2019

@snowp , running tools/check_format.py fix has touched a lot of other files as well. I have clang-format version 7.0.1 (tags/RELEASE_701/final) and buildifier from eb1a85ca787f0f5f94ba66f41ee66fdfd4c49b70 (tag: 0.26.0). Am I doing something wrong?

Should I revert the last 2 commits (format fix and master merge)?

@snowp
Copy link
Contributor

snowp commented Jun 19, 2019

Yeah please avoid changing files not related to this change. I tend to run the format script just on the files I've changed in a PR instead of on the whole repo to avoid this kinda stuff from happening.

@sriduth sriduth force-pushed the feature/retry-on-non-canary-host branch from 3d1bc6b to 93e440e Compare June 19, 2019 17:00
@sriduth
Copy link
Contributor Author

sriduth commented Jun 19, 2019

I should have checked the help section of the check_format.py script - my bad!

I've run the following and no diff is produced:

  • tools/check_format.py fix source/extensions/retry/host/omit_canary_hosts
  • tools/check_format.py fix source/extensions/retry/host
  • tools/check_format.py fix test/extensions/retry/host
  • tools/check_format.py fix test/extensions/retry/host/omit_canary_hosts

git diff master --name-only is now:

docs/root/intro/arch_overview/http/http_connection_management.rst
docs/root/intro/version_history.rst
source/extensions/extensions_build_config.bzl
source/extensions/retry/host/omit_canary_hosts/BUILD
source/extensions/retry/host/omit_canary_hosts/config.cc
source/extensions/retry/host/omit_canary_hosts/config.h
source/extensions/retry/host/omit_canary_hosts/omit_canary_hosts.h
source/extensions/retry/host/previous_hosts/config.h
source/extensions/retry/host/well_known_names.h
test/extensions/retry/host/omit_canary_hosts/BUILD
test/extensions/retry/host/omit_canary_hosts/config_test.cc

@sriduth
Copy link
Contributor Author

sriduth commented Jun 20, 2019

Should I add this to the CODEOWNERS file?

ERROR: New directory extensions/retry/host/omit_canary_hosts appears to not have owners in CODEOWNERS
ERROR: check format failed. run 'tools/check_format.py fix'

@snowp
Copy link
Contributor

snowp commented Jun 20, 2019

Yeah, please add yourself and me as the code owners.

Signed-off-by: Sriduth Jayhari <[email protected]>
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks this is looking really good, just a couple nits.

docs/root/intro/version_history.rst Outdated Show resolved Hide resolved
* Remove unrequired empty line in documentation for
  the predicate in http_connection_management.rst
* Improve wording and formatting that describes change
  in version_history.rst

Signed-off-by: Sriduth Jayhari <[email protected]>
@sriduth sriduth force-pushed the feature/retry-on-non-canary-host branch from 1b31992 to 21d3b9b Compare June 20, 2019 19:44
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@snowp snowp merged commit 2e03ef2 into envoyproxy:master Jun 20, 2019
sriduth added a commit to sriduth/envoy that referenced this pull request Jun 25, 2019
mattklein123 pushed a commit that referenced this pull request Jun 25, 2019
@mcasper
Copy link

mcasper commented Jul 1, 2019

It looks like this feature was added to the version 1.10 release notes, was that a mistake?

@sriduth
Copy link
Contributor Author

sriduth commented Jul 2, 2019

@mcasper you are right! i created the feature branch off the v.1.10.0 commit. This is bad - I'll open a PR to fix this right away.

sriduth added a commit to sriduth/envoy that referenced this pull request Jul 2, 2019
…r v1.11 version

      history.

Signed-off-by: Sriduth Jayhari <[email protected]>
mattklein123 pushed a commit that referenced this pull request Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

extenstion / feature request - omit canary hosts during retry of a failed request
3 participants