build: drop the gRPC transport that google-cloud-storage never uses here - #200
Merged
Merged
Conversation
google-cloud-storage ships two transports and declares the dependencies of both. GcsClient and the gcs: URL handler both build their client with StorageOptions.newBuilder(), which is the JSON over HTTP transport; the gRPC one is reachable only through StorageOptions.grpc(), which nothing calls. Its stack was still on the classpath and in every artifact that depends on this: 29 jars, 26.4 MiB, of which grpc-xds and grpc-netty-shaded are 21 MiB between them. Excluded: the gRPC runtime, gax-grpc, google-cloud-core-grpc, the generated gRPC storage client, the OpenTelemetry SDK, and google-cloud-monitoring with its protos, which are there for gRPC's client-side metrics. Three things stay, each because removing them breaks the JSON transport: - io.grpc:grpc-api. HttpStorageRpc#startSpan opens an OpenCensus span on every request, and OpenCensus keeps its current span in io.grpc.Context, which has lived in grpc-api since gRPC 1.60 -- the grpc-context artifact still exists but no longer holds the class. Excluding it threw NoClassDefFoundError on the first call. - proto-google-cloud-storage-v2. JsonConversions#bucketInfoDecode uses com.google.storage.v2.BucketName, so the v2 protos are shared between the two transports rather than belonging to the gRPC one. - opentelemetry api, context and common, which gax-httpjson uses. Both of those failures were found by running the tests, not by reading the dependency tree: the tree gives no hint that the JSON path reaches into either. What made the OpenTelemetry SDK safe to remove is that the only class in google-cloud-storage referencing it -- OpenTelemetryBootstrappingUtils -- has exactly one caller in the jar, GrpcStorageOptions. The same holds for the generated gRPC client: every class referencing com.google.storage.v2.StorageClient is either a Grpc* class or a BlobWriteSessionConfig factory that only a caller asking for gRPC uploads reaches. Verified with the full suite, 2057 tests, including GcsClientTest against fsouza/fake-gcs-server.
This was referenced Sep 8, 2026
marevol
added a commit
to codelibs/fess
that referenced
this pull request
Sep 9, 2026
…ere (#3415) GcsStorageClient builds its client with StorageOptions.newBuilder(), which is the JSON over HTTP transport. The gRPC one is reachable only through StorageOptions.grpc(), which nothing calls, but google-cloud-storage declares the dependencies of both, so the distribution carried the whole gRPC stack: 29 jars, 26.4 MiB, of which grpc-xds and grpc-netty-shaded are 21 MiB between them. The exclusion block is the same one as codelibs/fess-crawler#200. Fess declares google-cloud-storage directly, so the exclusions there do not reach it. Three things stay because removing them breaks the JSON transport: io.grpc:grpc-api, which holds io.grpc.Context that OpenCensus needs on every request; proto-google-cloud-storage-v2, which JsonConversions decodes bucket names with; and the OpenTelemetry api, context and common jars, which gax-httpjson uses.
marevol
added this pull request to stack #202
September 9, 2026 12:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
google-cloud-storageships two transports and declares the dependencies of both.GcsClientand thegcs:URL handler both build their client withStorageOptions.newBuilder(), which is the JSON-over-HTTP transport; the gRPC one isreachable only through
StorageOptions.grpc(), which nothing calls. Its stack was on theclasspath anyway, and in every artifact that depends on fess-crawler:
29 jars, 26.4 MiB removed, nothing added.
grpc-xds(10.5 MiB) andgrpc-netty-shaded(10.3 MiB) are 21 MiB of that between them.Three things deliberately kept
Each of these looks like part of the gRPC stack and is not:
io.grpc:grpc-apiHttpStorageRpc#startSpanopens an OpenCensus span on every request, and OpenCensus keeps its current span inio.grpc.Context— which has lived ingrpc-apisince gRPC 1.60. Thegrpc-contextartifact still exists but no longer holds the class.proto-google-cloud-storage-v2JsonConversions#bucketInfoDecodeusescom.google.storage.v2.BucketName. The v2 protos are shared between the transports.opentelemetry-api,-context,-commongax-httpjsonuses them.Both of the first two were found by running the tests, not by reading the dependency
tree. A first attempt excluded
io.grpc:*andproto-google-cloud-storage-v2; thatcompiles clean and then throws on the first call:
Worth knowing for anyone reviewing a similar change: compile-clean says nothing here.
Why the OpenTelemetry SDK and the generated gRPC client are safe
Not by argument — by reading the constant pools of the classes in
google-cloud-storage-2.71.0.jar:io/opentelemetry/sdkorcom/google/cloud/opentelemetry:OpenTelemetryBootstrappingUtils. Its only caller inthe jar is
GrpcStorageOptions.com/google/storage/v2/StorageClientis either aGrpc*classor a
BlobWriteSessionConfigfactory, which only a caller asking for gRPC uploadsreaches.
Verification
mvn test→ 2057 tests, 0 failures, 0 errors, BUILD SUCCESS, includingGcsClientTest(7 tests) againstfsouza/fake-gcs-servervia testcontainers, whichexercises create,
doGetanddoHeadover the real JSON API.Note for the Fess side
Fess declares
google-cloud-storagedirectly too, so these exclusions do not reach it;codelibs/fess needs the same block. That is a separate PR.