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(common): add GrpcCompressionAlgorithmOption #13108

Merged
merged 1 commit into from
Nov 11, 2023

Conversation

devbww
Copy link
Contributor

@devbww devbww commented Nov 11, 2023

Add a common option to set the gRPC compression algorithm, which can be used at both the client and individual-operation levels. (Previously, users could only affect client-to-server compression at the connection level, using GrpcChannelArgumentsNativeOption.)

  • It will take precedence over any compression algorithm set by the internal::GrpcSetupOption function.

  • The pubsub::CompressionAlgorithmOption takes precedence over any other settings during AsyncPublish() calls when the request-size threshold is met.

Exercise the new option in the Spanner client in two ways:

  • A new ConnectionImpl test to check that the compression algorithm from the prevailing options is reflected in the grpc::ClientContext passed to the stub.
  • Setting the compression algorithm used during the client integration tests, but overriding it on a few operations. (We can't directly observe the effect, but we've done our part.)

This change is Reviewable

Add a common option to set the gRPC compression algorithm, which
can be used at both the client and individual-operation levels.
(Previously, users could only affect client-to-server compression
at the connection level, using `GrpcChannelArgumentsNativeOption`.)

- It will take precedence over any compression algorithm set
  by the `internal::GrpcSetupOption` function.

- The `pubsub::CompressionAlgorithmOption` takes precedence
  over any other settings during `AsyncPublish()` calls when
  the request-size threshold is met.

Exercise the new option in the Spanner client in two ways:
- A new `ConnectionImpl` test to check that the compression
  algorithm from the prevailing options is reflected in the
  `grpc::ClientContext` passed to the stub.
- Setting the compression algorithm used during the client
  integration tests, but overriding it on a few operations.
  (We can't directly observe the effect, but we've done our
  part.)
Copy link

codecov bot commented Nov 11, 2023

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (6fbabb0) 92.99% compared to head (d9ef78f) 92.99%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13108   +/-   ##
=======================================
  Coverage   92.99%   92.99%           
=======================================
  Files        2135     2135           
  Lines      185608   185637   +29     
=======================================
+ Hits       172601   172632   +31     
+ Misses      13007    13005    -2     
Files Coverage Δ
google/cloud/grpc_options.cc 100.00% <100.00%> (ø)
...e/cloud/pubsub/internal/default_batch_sink_test.cc 97.36% <100.00%> (+0.03%) ⬆️
...gle/cloud/spanner/internal/connection_impl_test.cc 98.40% <100.00%> (+0.01%) ⬆️
...anner/integration_tests/client_integration_test.cc 72.30% <65.00%> (+0.03%) ⬆️

... and 6 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@devbww devbww marked this pull request as ready for review November 11, 2023 18:38
@devbww devbww requested a review from a team as a code owner November 11, 2023 18:38
@@ -135,6 +139,7 @@ TEST(DefaultBatchSinkTest, BasicWithCompression) {
std::move(mock), background.cq(),
DefaultPublisherOptions(
pubsub_testing::MakeTestOptions()
.set<GrpcCompressionAlgorithmOption>(GRPC_COMPRESS_NONE)
Copy link
Contributor

Choose a reason for hiding this comment

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

@alevenberg maybe we should consider using pubsub::CompressionAlgorithmOption = google::cloud::GrpcCompressionAlgorithmOption;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That might be problematic, given that pubsub::CompressionAlgorithmOption is given a default value (of GRPC_COMPRESS_DEFLATE).

@devbww devbww merged commit 7743b6a into googleapis:main Nov 11, 2023
59 checks passed
@devbww devbww deleted the spanner-compression branch November 11, 2023 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants