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

feat(pubsub): add policy options; default common options #7335

Merged
merged 1 commit into from
Sep 20, 2021

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Sep 20, 2021

Part of the work for #6306

This change may seem strange on its own, because the code it is "replacing" is not touched in this PR. I did this because the full change is too large, and I want the PR's to be manageable. A (somewhat accurate) draft of the bigger picture can be found here.

Here are the sources for the default values:

  • The logic related to PUBSUB_EMULATOR_HOST comes from internal/emulator_overrides* which will eventually be removed.
  • The defaults for options from GrpcOptionList and CommonOptionList come from: connection_options.cc, except for GrpcBackgroundThreadPoolSizeOption which comes from here (publisher) and here(subscriber)
  • The defaults for options from PolicyOptionList come from: here (publisher) and here (subscriber)** (Note the special retry policy for the subscriber)

This change is Reviewable

@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label Sep 20, 2021
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 20, 2021
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: d9d896342d1af6ea839fc8e622739d13981328b7

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Sep 20, 2021

Codecov Report

Merging #7335 (d9d8963) into main (99a1cfd) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##             main    #7335    +/-   ##
========================================
  Coverage   93.66%   93.67%            
========================================
  Files        1352     1352            
  Lines      116986   117092   +106     
========================================
+ Hits       109573   109682   +109     
+ Misses       7413     7410     -3     
Impacted Files Coverage Δ
google/cloud/internal/retry_policy.h 100.00% <100.00%> (ø)
google/cloud/pubsub/internal/defaults.cc 100.00% <100.00%> (ø)
google/cloud/pubsub/internal/defaults_test.cc 100.00% <100.00%> (ø)
google/cloud/pubsub/subscriber_options.cc 100.00% <100.00%> (ø)
google/cloud/pubsub/samples/samples.cc 91.97% <0.00%> (-0.08%) ⬇️
...le/cloud/storage/internal/curl_download_request.cc 89.25% <0.00%> (+0.74%) ⬆️
google/cloud/grpc_error_delegate.cc 100.00% <0.00%> (+4.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 99a1cfd...d9d8963. Read the comment docs.

@dbolduc dbolduc marked this pull request as ready for review September 20, 2021 19:26
@dbolduc dbolduc requested a review from a team as a code owner September 20, 2021 19:26
Comment on lines +44 to +48
auto emulator = internal::GetEnv("PUBSUB_EMULATOR_HOST");
if (emulator.has_value()) {
opts.set<EndpointOption>(*emulator).set<GrpcCredentialOption>(
grpc::InsecureChannelCredentials());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps move this next to the other setting for GrpcCredentialOption?

Copy link
Member Author

Choose a reason for hiding this comment

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

the EndpointOptions are colocated 🤷‍♂️

@dbolduc dbolduc merged commit 081289c into googleapis:main Sep 20, 2021
@dbolduc dbolduc deleted the pubsub-add-common-options branch September 20, 2021 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants