Skip to content

router: add support for retry options predicate extensions#18058

Merged
mattklein123 merged 14 commits intomainfrom
retry_options_predicate
Sep 15, 2021
Merged

router: add support for retry options predicate extensions#18058
mattklein123 merged 14 commits intomainfrom
retry_options_predicate

Conversation

@mattklein123
Copy link
Copy Markdown
Member

This was built for Envoy Mobile, but will allow generic modification
of router behavior between retries. Currently it only supports modifying
upstream socket options (to in practice impact interface binding), but
in the future is likely to be extended to modify timeouts, retry back
off times, request headers, etc.

Risk Level: Low. New feature.
Testing: Unit tests.
Docs Changes: N/A
Release Notes: Added.
Platform Specific Features: N/A

This was built for Envoy Mobile, but will allow generic modification
of router behavior between retries. Currently it only supports modifying
upstream socket options (to in practice impact interface binding), but
in the future is likely to be extended to modify timeouts, retry back
off times, request headers, etc.

Signed-off-by: Matt Klein <mklein@lyft.com>
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/envoy/.
envoyproxy/api-shepherds assignee is @adisuissa
CC @envoyproxy/api-watchers: FYI only for changes made to api/envoy/.

🐱

Caused by: #18058 was opened by mattklein123.

see: more, trace.

Copy link
Copy Markdown
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

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

Looks good!
Left an API comment, and a small nit.

Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
Copy link
Copy Markdown
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

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

/lgtm api

@mattklein123
Copy link
Copy Markdown
Member Author

/assign-from @envoyproxy/senior-maintainers

@repokitteh-read-only
Copy link
Copy Markdown

@envoyproxy/senior-maintainers assignee is @ggreenway

🐱

Caused by: a #18058 (comment) was created by @mattklein123.

see: more, trace.

Signed-off-by: Matt Klein <mklein@lyft.com>
Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

Looks good overall. Think it's worth adding an integration test to make sure option updates really work?

/wait

new Http::TestResponseHeaderMapImpl{{":status", "503"}});
EXPECT_CALL(cm_.thread_local_cluster_.conn_pool_.host_->outlier_detector_,
putHttpResponseCode(503));
// NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage)
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.

Why is this needed? This looks like a bunch of similar code throughout the file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I really have no idea, but tidy was flagging this line, so I put in this exclusion.

@mattklein123
Copy link
Copy Markdown
Member Author

Think it's worth adding an integration test to make sure option updates really work?

I thought about this, but I'm not quite sure how to do this since right now it only supports setting socket options. Can you think of any socket option that I could set that would somehow be obvious in an integration test?

@ggreenway
Copy link
Copy Markdown
Member

Think it's worth adding an integration test to make sure option updates really work?

I thought about this, but I'm not quite sure how to do this since right now it only supports setting socket options. Can you think of any socket option that I could set that would somehow be obvious in an integration test?

Could set a no-op option, and verify that it at least makes it use a new connpool. I don't know that there's a good one to directly verify a socket option on the remote end.

@mattklein123
Copy link
Copy Markdown
Member Author

Could set a no-op option, and verify that it at least makes it use a new connpool. I don't know that there's a good one to directly verify a socket option on the remote end.

Do you know offhand a good no-op option? I guess I could set some TCP keep alive settings or something.

@ggreenway
Copy link
Copy Markdown
Member

Yeah, keepalive is a good choice. Widely available, and won't do anything bad/harmful in the test.

@mattklein123
Copy link
Copy Markdown
Member Author

Thanks for the nudge, it turns out that we are not setting hashKey() on most socket options, making this feature not actually work in practice. :) cc @goaway

Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
Copy link
Copy Markdown
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

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

/lgtm api

Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

LGTM

@mattklein123 mattklein123 merged commit 5b1015c into main Sep 15, 2021
@mattklein123 mattklein123 deleted the retry_options_predicate branch September 15, 2021 19:18
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.

3 participants