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

spanner: update the code sample to set timeout at method level #3805

Closed
hengfengli opened this issue Sep 23, 2020 · 7 comments · Fixed by googleapis/java-spanner#707
Closed
Assignees
Labels
api: spanner Issues related to the Spanner API. priority: p2 Moderately-important priority. Fix may not be included in next release. samples Issues that are directly related to samples. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@hengfengli
Copy link

The current code sample of setting the custom timeout is based on the client level. We recently have added the ability to set the timeout at the method level: googleapis/java-spanner#379. Are we able to update the existing code sample?

@hengfengli hengfengli added the api: spanner Issues related to the Spanner API. label Sep 23, 2020
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Sep 23, 2020
@hengfengli hengfengli changed the title Update the code sample to set timeout at method level spanner: update the code sample to set timeout at method level Sep 23, 2020
@olavloite
Copy link
Contributor

@hengfengli The current sample shows how to set both custom timeout and retry settings. The new feature that we added supports setting a timeout per method call, but not retry settings. So there are a couple of possible changes that we could do:

  1. Change the sample to only set a custom timeout, and not custom retry settings.
  2. Change the sample to set custom retry settings for the ExecuteSql method for all calls (i.e. what the current sample does), and a custom timeout for a specific call.
  3. Add a new sample that sets a custom timeout for a specific call.

My preference would be option 1, as it keeps the sample relatively simple and shows the most common use case. Setting a custom timeout is something many users might want to do, setting custom retry codes is not something many users would (should) do.

WDYT?

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Sep 23, 2020
olavloite added a commit to olavloite/java-docs-samples that referenced this issue Sep 25, 2020
Use the newly added feature that allows a client to set a custom
timeout for a method call, instead of using the static option when
creating a client.

Fixes GoogleCloudPlatform#3805
@lesv lesv added priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels Sep 25, 2020
@hengfengli
Copy link
Author

@olavloite Sorry for the late reply. Option 1 sounds okay to me. But the only issue is that now we have a public page for this code sample: https://cloud.google.com/spanner/docs/custom-timeout-and-retry. If we choose Option 1, then the code does not match the text.

@olavloite
Copy link
Contributor

@olavloite Sorry for the late reply. Option 1 sounds okay to me. But the only issue is that now we have a public page for this code sample: https://cloud.google.com/spanner/docs/custom-timeout-and-retry. If we choose Option 1, then the code does not match the text.

Hmm... Then I don't think we should use option 1, at least not for this specific sample. I would then suggest adding a separate sample for only setting a timeout for a specific call. That won't show up in the documentation page, but at least people could find it in the sample code.

@hengfengli
Copy link
Author

The plan sounds good to me.

@lesv
Copy link
Contributor

lesv commented Dec 9, 2020

What's the status of this?

olavloite added a commit to googleapis/java-spanner that referenced this issue Dec 10, 2020
Adds a sample for setting a timeout for a single RPC.

Fixes GoogleCloudPlatform/java-docs-samples#3805
@olavloite
Copy link
Contributor

What's the status of this?

Thanks for the ping, this had unfortunately fallen of my radar. The Spanner samples are currently (also) in the java-spanner repository. I've added a PR for this over there now.

@thiagotnunes Do you know what the status is of the samples at the moment? Should we add them to both the repositories? Or should they only be added to java-spanner.

@thiagotnunes
Copy link
Contributor

@olavloite only java-spanner should be sufficient.

thiagotnunes pushed a commit to googleapis/java-spanner that referenced this issue Jan 6, 2021
* docs: add sample for timeout for one RPC

Adds a sample for setting a timeout for a single RPC.

Fixes GoogleCloudPlatform/java-docs-samples#3805

* fix: fix import order

* fix: format code with the correct formatter plugin

* fix: delete test data after each test

* fix: auto-throttle admin requests
thiagotnunes pushed a commit to googleapis/java-spanner that referenced this issue May 6, 2021
* docs: add sample for timeout for one RPC

Adds a sample for setting a timeout for a single RPC.

Fixes GoogleCloudPlatform/java-docs-samples#3805

* fix: fix import order

* fix: format code with the correct formatter plugin

* fix: delete test data after each test

* fix: auto-throttle admin requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API. priority: p2 Moderately-important priority. Fix may not be included in next release. samples Issues that are directly related to samples. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
5 participants