Skip to content

impl(storage): configure gRPC ClientContext using CurrentOptions#9453

Merged
dbolduc merged 1 commit intogoogleapis:mainfrom
dbolduc:storage-grpc-configure-context
Jul 12, 2022
Merged

impl(storage): configure gRPC ClientContext using CurrentOptions#9453
dbolduc merged 1 commit intogoogleapis:mainfrom
dbolduc:storage-grpc-configure-context

Conversation

@dbolduc
Copy link
Copy Markdown
Member

@dbolduc dbolduc commented Jul 12, 2022

Configure the grpc::ClientContexts created by a storage::internal::GrpcClient using the CurrentOptions().

Note that, as of writing this, the only option that does anything is google::cloud::internal::GrpcSetupOption. And we do not set this option. So we are only gaining a hook for debugging. And we are doing some extra map lookups on every client call. That is not obviously great.

But, if we ever add an option for setting metadata or for setting a deadline we can have it take effect in google::cloud::internal::ConfigureContext(..., Options). for gRPC. (See #4926 (comment) for how I see things playing out)


This change is Reviewable

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jul 12, 2022
@google-cloud-cpp-bot
Copy link
Copy Markdown
Contributor

Google Cloud Build Logs
For commit: 1b52aa0c56f42d05cfe501ab6a18c11a47a9e41a

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 12, 2022

Codecov Report

Merging #9453 (1b52aa0) into main (ac964c9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #9453   +/-   ##
=======================================
  Coverage   94.63%   94.63%           
=======================================
  Files        1486     1486           
  Lines      136679   136689   +10     
=======================================
+ Hits       129342   129356   +14     
+ Misses       7337     7333    -4     
Impacted Files Coverage Δ
...d/storage/internal/grpc_configure_client_context.h 100.00% <100.00%> (ø)
...age/internal/grpc_configure_client_context_test.cc 100.00% <100.00%> (ø)
...cloud/pubsub/internal/subscription_session_test.cc 97.98% <0.00%> (ø)
...le/cloud/storage/internal/curl_download_request.cc 88.59% <0.00%> (+1.00%) ⬆️
...e/cloud/pubsublite/internal/alarm_registry_impl.cc 100.00% <0.00%> (+2.94%) ⬆️

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 ac964c9...1b52aa0. Read the comment docs.

@dbolduc dbolduc marked this pull request as ready for review July 12, 2022 07:04
@dbolduc dbolduc requested a review from a team July 12, 2022 07:04
EXPECT_CALL(mock, Call);

google::cloud::internal::OptionsSpan span(
Options{}.set<google::cloud::internal::GrpcSetupOption>(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A word of caution on what seems to be going on here.

An "internal option" implies to me that we're using thread locals to (conveniently?) plumb state through call layers.
I reckon such things would be better passed explicitly. Options should be reserved for truly optional things from the user. [Off soap box, and apologies if I'm mistaken.]

Copy link
Copy Markdown
Member Author

@dbolduc dbolduc Jul 12, 2022

Choose a reason for hiding this comment

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

Ack. The change is confusing on the surface. We are not using internal::GrpcSetupOption for state.

Basically, I want to test that current options (supplied by the user) will be used when setting up the grpc::ClientContext. But there are no such public options right now. So we test the one option that does anything: internal::GrpcSetupOption. In the future, I could see GrpcSetupOption being released, or see us adding other options like a MetadataOption. #4926 (comment)

@dbolduc dbolduc merged commit ead714b into googleapis:main Jul 12, 2022
@dbolduc dbolduc deleted the storage-grpc-configure-context branch July 12, 2022 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants