thrift proxy: add request shadowing support (#17544)

This is the last PR in the series dedicated to adding mirroring support.
It adds:

* the ShadowWriter which is used by the Router filter to mirror requests
* a ShadowRouter which is a RequestOwner that reuses the existing UpstreamRequest

There's still room for more code sharing and better interfaces, but that
can happen in future iterations.

Signed-off-by: Raul Gutierrez Segales <rgs@pinterest.com>

Mirrored from https://github.com/envoyproxy/envoy @ 7a93615ec1077bbb3b20ada1fc8a440751da1c9f
pull/624/head
data-plane-api(Azure Pipelines) 3 years ago
parent 0f1afc8952
commit f9fd4fb1f6
  1. 27
      envoy/extensions/filters/network/thrift_proxy/v3/route.proto
  2. 30
      envoy/extensions/filters/network/thrift_proxy/v4alpha/route.proto

@ -81,11 +81,33 @@ message RouteMatch {
repeated config.route.v3.HeaderMatcher headers = 4;
}
// [#next-free-field: 7]
// [#next-free-field: 8]
message RouteAction {
option (udpa.annotations.versioning).previous_message_type =
"envoy.config.filter.network.thrift_proxy.v2alpha1.RouteAction";
// The router is capable of shadowing traffic from one cluster to another. The current
// implementation is "fire and forget," meaning Envoy will not wait for the shadow cluster to
// respond before returning the response from the primary cluster. All normal statistics are
// collected for the shadow cluster making this feature useful for testing.
//
// .. note::
//
// Shadowing will not be triggered if the primary cluster does not exist.
message RequestMirrorPolicy {
// Specifies the cluster that requests will be mirrored to. The cluster must
// exist in the cluster manager configuration when the route configuration is loaded.
// If it disappears at runtime, the shadow request will silently be ignored.
string cluster = 1 [(validate.rules).string = {min_len: 1}];
// If not specified, all requests to the target cluster will be mirrored.
//
// For some fraction N/D, a random number in the range [0,D) is selected. If the
// number is <= the value of the numerator N, or if the key is not present, the default
// value, the request will be mirrored.
config.core.v3.RuntimeFractionalPercent runtime_fraction = 2;
}
oneof cluster_specifier {
option (validate.required) = true;
@ -123,6 +145,9 @@ message RouteAction {
// Strip the service prefix from the method name, if there's a prefix. For
// example, the method call Service:method would end up being just method.
bool strip_service_name = 5;
// Indicates that the route has request mirroring policies.
repeated RequestMirrorPolicy request_mirror_policies = 7;
}
// Allows for specification of multiple upstream clusters along with weights that indicate the

@ -81,11 +81,36 @@ message RouteMatch {
repeated config.route.v4alpha.HeaderMatcher headers = 4;
}
// [#next-free-field: 7]
// [#next-free-field: 8]
message RouteAction {
option (udpa.annotations.versioning).previous_message_type =
"envoy.extensions.filters.network.thrift_proxy.v3.RouteAction";
// The router is capable of shadowing traffic from one cluster to another. The current
// implementation is "fire and forget," meaning Envoy will not wait for the shadow cluster to
// respond before returning the response from the primary cluster. All normal statistics are
// collected for the shadow cluster making this feature useful for testing.
//
// .. note::
//
// Shadowing will not be triggered if the primary cluster does not exist.
message RequestMirrorPolicy {
option (udpa.annotations.versioning).previous_message_type =
"envoy.extensions.filters.network.thrift_proxy.v3.RouteAction.RequestMirrorPolicy";
// Specifies the cluster that requests will be mirrored to. The cluster must
// exist in the cluster manager configuration when the route configuration is loaded.
// If it disappears at runtime, the shadow request will silently be ignored.
string cluster = 1 [(validate.rules).string = {min_len: 1}];
// If not specified, all requests to the target cluster will be mirrored.
//
// For some fraction N/D, a random number in the range [0,D) is selected. If the
// number is <= the value of the numerator N, or if the key is not present, the default
// value, the request will be mirrored.
config.core.v4alpha.RuntimeFractionalPercent runtime_fraction = 2;
}
oneof cluster_specifier {
option (validate.required) = true;
@ -123,6 +148,9 @@ message RouteAction {
// Strip the service prefix from the method name, if there's a prefix. For
// example, the method call Service:method would end up being just method.
bool strip_service_name = 5;
// Indicates that the route has request mirroring policies.
repeated RequestMirrorPolicy request_mirror_policies = 7;
}
// Allows for specification of multiple upstream clusters along with weights that indicate the

Loading…
Cancel
Save