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
Add GAX call_options to methods making API calls #849
Conversation
Allow for GRPC/GAX behavior to be configured on methods that make API calls. This leaks the GAX implementation to the google-cloud public API. If Gax changes its implementation this may result in a change to the google-cloud public API.
@timanovsky This also isn't Datastore, but this is also the approach we are considering for configuring GRPC/GAX call requests. Can you look at this and let us know what you think of this? Would you prefer leaking the GAX client configuration over the GAX call configuration? Do you need/want both? |
@jmuk Can you also weigh in on this? How comfortable are you with gcloud-ruby leaking the GAX call configuration? How likely are we to see breaking changes to the call configuration? Would love to get your thoughts. |
@bmclean Or this? |
I commented on #848. |
Sorry, for the late comment on this. As an API user I'm ok having gcloud.with_call_options(my_options) do
results = gcloud.language.annotate "Hello world!"
end One catch is to implement it in a thread safe way. |
We can re-open this if the need arises, but closing for now. |
This is an attempt to allow users more control over the behavior of the client making API calls. GAX implements retries and incremental backoff, but the GAX configuration is a bit different than what is used by other services. This is an option to allow users to override the GAX configuration on the API call while continuing to use Google Cloud. #848 allows users to configure the client settings, but this PR is for configuring the API call settings. Either approach is independent of the other.
This change is additive, but it does leak the GAX implementation to the Google Cloud Language public API. This means that if GAX ever changes its implementation Google Cloud Language may need to also make a breaking change to support the new GAX API. So far we have resisted leaking these types of details, but there is no better way to allow the GAX client to be fully configurable other than leaking these details.
What do you think of this type of change? Is this a direction you want to see the other GRPC/GAX services move towards?
The call_config hash can contain any part of the GAX CallOptions object structure. Here is what this may look like: