Skip to content
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

Merged
merged 7 commits into from Aug 17, 2018

Conversation

venilnoronha
Copy link
Member

@venilnoronha venilnoronha commented Aug 14, 2018

This PR deprecates the integer percent field in Delay and Abort types in favor of the new double percentage 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

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>
@istio-testing
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: kyessenov

If they are not already assigned, you can assign the PR to them by writing /assign @kyessenov in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Aug 14, 2018
@venilnoronha
Copy link
Member Author

/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;
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in fe10f32.

Copy link
Member

@rshriram rshriram left a 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>
@venilnoronha venilnoronha changed the title Deprecate int percent in favor of FractionalPercent Deprecate int percent in favor of double percentage Aug 15, 2018
@@ -938,17 +938,18 @@ message HTTPFaultInjection {
// subset: v1
// fault:
// delay:
// percent: 10
// percentage: 0.000001
Copy link
Member

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%.

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in 9628157.

@kyessenov
Copy link
Contributor

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>
@rshriram
Copy link
Member

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.

@wora
Copy link
Contributor

wora commented Aug 15, 2018 via email

* 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>
@venilnoronha
Copy link
Member Author

I've addressed the changes via 35280a4 and aee3bd2.

@wora
Copy link
Contributor

wora commented Aug 17, 2018 via email

@venilnoronha
Copy link
Member Author

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)
Copy link
Member

Choose a reason for hiding this comment

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

???

Copy link
Member Author

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.

Copy link
Member

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

// Identifies a percentage, in the range [0.0, 100.0].
message Percent {
double value = 1;
}
Copy link
Member

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;
Copy link
Member

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>
@venilnoronha
Copy link
Member Author

@rshriram all comments have been addressed via 81320ce and 6418b55.

@rshriram
Copy link
Member

/ok-to-test

@rshriram rshriram merged commit 214c759 into istio:master Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants