-
Notifications
You must be signed in to change notification settings - Fork 573
Deprecate int percent in favor of double percentage #609
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
Deprecate int percent in favor of double percentage #609
Conversation
This commit deprecates the integer percent field in Delay and Abort types in favor of the new FractionalPercent type which allows finer control. Signed-off-by: Venil Noronha <veniln@vmware.com>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: If they are not already assigned, you can assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @kyessenov |
@@ -1001,6 +1011,9 @@ message HTTPFaultInjection { | |||
// $hide_from_docs | |||
string http2_error = 4; | |||
} | |||
|
|||
// Percentage of requests to be aborted with the error code provided. | |||
FractionalPercent percentage = 5; |
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.
we shouldn't use the envoy model as it is here. Please use double or float and then derive the envoy level stuff automatically from the user specified value.
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.
Addressed in fe10f32.
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.
change fractional percent to double and derive the fractional percent from it.
Signed-off-by: Venil Noronha <veniln@vmware.com>
@@ -938,17 +938,18 @@ message HTTPFaultInjection { | |||
// subset: v1 | |||
// fault: | |||
// delay: | |||
// percent: 10 | |||
// percentage: 0.000001 |
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.
Update the explanation above this example that says delay 10% of requests. It should say delay 1 out of every 1000 requests (and change the percentage to 0.001 everywhere). Do the same for all example texts that say 10%.
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.
Addressed in 9628157.
Floats make me a bit uncomfortable. Note that these protos go through JSON translation that loses all number precision (since Javascript has only one number datatype), so that's some loss of precision during internal processing. I'd hate to find out that some small number like 0.000001 gets approximated to 0 internally in istio. |
Signed-off-by: Venil Noronha <veniln@vmware.com>
Do we know the bounds for this? I am happy supporting precision upto 3 digits or 4 digits. the clunky numerator/denominator thing is not helpful. |
Please consider using standard type defined by `envoy.type.Percent`
package. It was created for this use case. While it may not be perfect, it
is still better for Istio to align with Envoy.
|
* The "type" in envoy.type.Percent is renamed to "types" in istio.envoy.types.Percent to avoid a keyword conflict in Golang. * The Makefile splits the *.pb.go file generation for v2alpha1/*.proto and types/*.proto in order to avoid the "inconsistent package names" error in protoc-gen-go. Signed-off-by: Venil Noronha <veniln@vmware.com>
Signed-off-by: Venil Noronha <veniln@vmware.com>
Is there any reason we cannot use Envoy definition directly? I assume Istio
has to trust Envoy anyway.
|
As per the readme, this project should be independent of others. |
Makefile
Outdated
envoy_types_pb_pythons := $(envoy_types_protos:.proto=_pb2.py) | ||
envoy_v2alpha1_protos := $(shell find $(envoy_path) -type f -path '*/v2alpha1/*' -name '*.proto' | sort) | ||
envoy_v2alpha1_pb_gos := $(envoy_v2alpha1_protos:.proto=.pb.go) | ||
envoy_v2alpha1_pb_pythons := $(envoy_v2alpha1_protos:.proto=_pb2.py) |
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.
???
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.
See golang/protobuf#39.
Attempting to generate *.pb.go
for protos under different packages causes an error currently.
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.
Revert all of this please
envoy/types/percent.proto
Outdated
// Identifies a percentage, in the range [0.0, 100.0]. | ||
message Percent { | ||
double value = 1; | ||
} |
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.
revert
@@ -958,11 +961,14 @@ message HTTPFaultInjection { | |||
// $hide_from_docs | |||
google.protobuf.Duration exponential_delay = 3 ; | |||
} | |||
|
|||
// Percentage of requests on which the delay will be injected. | |||
istio.envoy.types.Percent percentage = 5; |
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.
define a Percent message in this API and use it. Don't want to import from another packages. As such proto generated docs are not that friendly.
Signed-off-by: Venil Noronha <veniln@vmware.com>
Signed-off-by: Venil Noronha <veniln@vmware.com>
/ok-to-test |
This PR deprecates the integer
percent
field inDelay
andAbort
types in favor of the new doublepercentage
field which allows finer control.This PR serves as a prereq for the changes necessary for istio/istio#7903.
Signed-off-by: Venil Noronha veniln@vmware.com
/cc @rshriram