fault: use FractionalPercent for percent (#3978)

The existing FaultDelay config used uint32 for the percent field which
limited the user to configure percentages only in terms of whole numbers
between 0 and 100. FractionalPercent allows finer control over the
percent values by allowing fractions to be specified in the
configuration, for example 0.0001%.

Signed-off-by: Venil Noronha <veniln@vmware.com>

Mirrored from https://github.com/envoyproxy/envoy @ 714ae130a6cb0d9c4bcef6cd5e3a0e698bdad370
pull/620/head
data-plane-api(CircleCI) 6 years ago
parent 034c84cb7d
commit f01638479c
  1. 1
      envoy/config/filter/fault/v2/BUILD
  2. 11
      envoy/config/filter/fault/v2/fault.proto
  3. 1
      envoy/config/filter/http/fault/v2/BUILD
  4. 13
      envoy/config/filter/http/fault/v2/fault.proto

@ -9,4 +9,5 @@ api_proto_library_internal(
"//envoy/config/filter/http/fault/v2:__pkg__",
"//envoy/config/filter/network/mongo_proxy/v2:__pkg__",
],
deps = ["//envoy/type:percent"],
)

@ -3,6 +3,8 @@ syntax = "proto3";
package envoy.config.filter.fault.v2;
option go_package = "v2";
import "envoy/type/percent.proto";
import "google/protobuf/duration.proto";
import "validate/validate.proto";
@ -24,7 +26,11 @@ message FaultDelay {
// An integer between 0-100 indicating the percentage of operations/connection requests
// on which the delay will be injected.
uint32 percent = 2 [(validate.rules).uint32.lte = 100];
//
// .. attention::
//
// Use of integer `percent` value is deprecated. Use fractional `percentage` field instead.
uint32 percent = 2 [(validate.rules).uint32.lte = 100, deprecated = true];
oneof fault_delay_secifier {
option (validate.required) = true;
@ -37,4 +43,7 @@ message FaultDelay {
google.protobuf.Duration fixed_delay = 3
[(validate.rules).duration.gt = {}, (gogoproto.stdduration) = true];
}
// The percentage of operations/connection requests on which the delay will be injected.
envoy.type.FractionalPercent percentage = 4;
}

@ -8,5 +8,6 @@ api_proto_library_internal(
deps = [
"//envoy/api/v2/route",
"//envoy/config/filter/fault/v2:fault",
"//envoy/type:percent",
],
)

@ -3,8 +3,9 @@ syntax = "proto3";
package envoy.config.filter.http.fault.v2;
option go_package = "v2";
import "envoy/config/filter/fault/v2/fault.proto";
import "envoy/api/v2/route/route.proto";
import "envoy/config/filter/fault/v2/fault.proto";
import "envoy/type/percent.proto";
import "validate/validate.proto";
@ -14,7 +15,11 @@ import "validate/validate.proto";
message FaultAbort {
// An integer between 0-100 indicating the percentage of requests/operations/connections
// that will be aborted with the error code provided.
uint32 percent = 1 [(validate.rules).uint32.lte = 100];
//
// .. attention::
//
// Use of integer `percent` value is deprecated. Use fractional `percentage` field instead.
uint32 percent = 1 [(validate.rules).uint32.lte = 100, deprecated = true];
oneof error_type {
option (validate.required) = true;
@ -22,6 +27,10 @@ message FaultAbort {
// HTTP status code to use to abort the HTTP request.
uint32 http_status = 2 [(validate.rules).uint32 = {gte: 200, lt: 600}];
}
// The percentage of requests/operations/connections that will be aborted with the error code
// provided.
envoy.type.FractionalPercent percentage = 3;
}
message HTTPFault {

Loading…
Cancel
Save