-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
router: allow propagating attempt count in header #4536
Changes from 2 commits
f0ba9c9
c232954
6b5196c
748454d
a9a0e7e
b7e7c30
8c34b6c
089f360
2d277e2
5ccf298
ccba26f
9139c59
5d04f1e
14b863d
d969b65
dbea290
2ce5c0e
265a86d
94f8890
9956e67
71d07e5
66d46e7
8605e5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,9 @@ message VirtualHost { | |
// for if and how it is utilized. | ||
map<string, google.protobuf.Struct> per_filter_config = 12; | ||
|
||
// Decides whether the x-envoy-attempt-count header should be included in upstream | ||
// <config_http_filters_router_x-envoy-original-path>` header. | ||
// Decides whether the :ref:`x-envoy-attempt-count | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How this play with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now it doesn't interact with it at all, not sure if it would be more confusing to have two different flags affect whether it's enabled? My take on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine either way, perhaps document the behavior when both are true? @htuch any suggestion? |
||
// <config_http_filters_router_x-envoy-attempt-count>` header should be included in upstream | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: s/in/in the |
||
// request. Defaults to false. | ||
bool include_request_attempt_count = 14; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: update next free id in comment above. |
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,16 @@ ingress/response path. They are documented in this section. | |
.. contents:: | ||
:local: | ||
|
||
.. _config_http_filters_router_x-envoy-attempt-count: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be in the "set" section below vs. the "consumed" section? |
||
|
||
x-envoy-attempt-count | ||
^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Sent to the upstream to indicate which attempt the current request is in a series of retries. The value | ||
will be "1" on the initial request, incremeting by one for each retry. Only set if the | ||
:ref:`include_attempt_count_header <envoy_api_field_route.VirtualHost.include_request_attempt_count>` | ||
flag is set to true. | ||
|
||
.. _config_http_filters_router_x-envoy-max-retries: | ||
|
||
x-envoy-max-retries | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -620,6 +620,8 @@ class RouteEntry : public ResponseEntry { | |
}; | ||
|
||
/** | ||
* True if the virtual host this RouteEntry belongs to is configured to include the attempt | ||
* count header. | ||
* @return bool whether x-envoy-attempt-count should be included on the upstream request. | ||
*/ | ||
virtual bool includeAttemptCount() const PURE; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only see configuration for virtual host. Is this used? Do we need route configuration also? If we don't want this now can you comment that this is pulled from the virtual host config currently? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's used since I plumb through the option from the vhost. I'll add a comment Re whether we want it on the route configuration: at least for our purposes we want to enable it on per domain/vhost level, so I'd defer per route configuration until somebody needs it |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,7 +289,7 @@ Http::FilterHeadersStatus Filter::decodeHeaders(Http::HeaderMap& headers, bool e | |
|
||
include_attempt_count_ = route_entry_->includeAttemptCount(); | ||
if (include_attempt_count_) { | ||
headers.insertEnvoyAttemptCount().value(1); | ||
headers.insertEnvoyAttemptCount().value(attempt_count_); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My one drive by comment is it's worth documenting how this will work when you have 2 levels of Envoys. It's not uncommon in production to have [L1 Envoy][L2 Envoy][upstream]. Granted, it's often a bad idea to have both levels doing retries as more often than not you end up with exponential retries (L2 retries 3 times, fails, L1 retries to new L1, L2 retries 3 times fails, etc) so I don't think it's a bad thing for the last Envoy in the chain to force-overwritten, but I think it's worth calling out it replaces any existing header. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds reasonable, I'll update the documentation |
||
} | ||
|
||
route_entry_->finalizeRequestHeaders(headers, callbacks_->streamInfo(), | ||
|
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.
is this related to
x-envoy-original-path
?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.
no it's not, that must have snuck it somehow