Skip to content

fix(storage): align host and universe domain resolution with ServiceOptions - #15266

Closed
nidhiii-27 wants to merge 7 commits into
mainfrom
fix/storage-universe-domain-host-resolution
Closed

nidhiii-27 wants to merge 7 commits into
mainfrom
fix/storage-universe-domain-host-resolution

Conversation

@nidhiii-27

@nidhiii-27 nidhiii-27 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

HttpStorageOptions and GrpcStorageOptions derive their default host from ServiceOptions.resolveUniverseDomain() and preserve explicitly configured hosts via ServiceOptions.hasExplicitHost(), removing superseded host-tracking helpers from StorageOptions. GrpcStorageOptions, StorageClientMetrics, and StorageImpl use ServiceOptions.resolveUniverseDomain() when deriving monitoring and signing hostnames, and StorageImpl applies caller-provided extension headers after the derived host header. Default googleapis.com host and endpoint resolution remain unchanged for existing configurations. Updated unit tests in StorageOptionsBuilderTest, StorageImplMockitoTest, StorageClientMetricsTest, SerializationTest, and TestUtils.

ServiceOptions resolves the universe domain for getResolvedHost, getResolvedApiaryHost, and hasValidUniverseDomain with the same precedence as GAX EndpointContext. GrpcStorageOptions.Builder derives its default host from ServiceOptions.getResolvedHost and applies an explicitly configured host ahead of the universe domain, consistent with HttpStorageOptions, while GrpcStorageOptions, StorageClientMetrics, and StorageImpl use getResolvedUniverseDomainForService. Default googleapis.com resolution remains unchanged. Added unit tests in ServiceOptionsTest, StorageOptionsBuilderTest, and StorageImplMockitoTest.

[Generated-by: AI]
@nidhiii-27 nidhiii-27 added the ai-generated Pull Request generated by AI label Nov 27, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces support for resolving the Google Cloud universe domain from the GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable when it is not explicitly configured. Key changes include updating ServiceOptions to resolve the universe domain dynamically, adapting GrpcStorageOptions and StorageImpl to utilize this resolved value, and adding comprehensive unit tests to verify correct host and endpoint resolution across HTTP and gRPC transports. There are no review comments, so I have no feedback to provide.

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@nidhiii-27
nidhiii-27 marked this pull request as ready for review November 29, 2026 16:26
@nidhiii-27
nidhiii-27 requested review from a team as code owners November 29, 2026 16:26
@nidhiii-27
nidhiii-27 requested a review from Dhriti07 November 29, 2026 16:26
@nidhiii-27 nidhiii-27 changed the title fix: align host and universe domain resolution with EndpointContext fix(storage): align host and universe domain resolution with ServiceOptions Dec 2, 2026
endpoint,
this.getProjectId(),
this.getUniverseDomain(),
this.resolveUniverseDomain(),

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.

[AI] OpenTelemetryBootstrappingUtils.createMetricServiceSettings already reads GOOGLE_CLOUD_UNIVERSE_DOMAIN when universeDomain is null, and relies on null to skip exporting metrics when the storage host doesn't end in .googleapis.com. Passing resolveUniverseDomain() here (and in StorageClientMetrics.java:120) falls back to "googleapis.com" when nothing is configured, which bypasses that guard and configures Cloud Monitoring export for custom hosts like localhost:9000 when default credentials are present.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Closing this PR as superseded by #15235, #15238 and #15239, which cover the same host and universe domain resolution; their metrics wiring passes the configured universe domain, which stays unset when none is configured.

Co-authored by AI Agent

@Dhriti07 Dhriti07 left a comment

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.

LGTM Subject to review of the AI comment left

@nidhiii-27

Copy link
Copy Markdown
Contributor Author

Superseded by #15235, #15238 and #15239, which cover this change.

@nidhiii-27 nidhiii-27 closed this Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Pull Request generated by AI storage-bug-immunity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants