Repository navigation
feat: add universeDomain support and remove hardcoded spanner.googleapis.com endpoint - #443
Merged
sakthivelmanii merged 5 commits intoDec 4, 2026
Conversation
olavloite
approved these changes
Dec 4, 2026
| ## Credentials, universe domain, and lifecycle | ||
|
|
||
| - **Credentials and universe domain**: Built-in metrics reuse the credentials configured on `SpannerCqlSessionBuilder` (falling back to Application Default Credentials when none are provided) and export to `monitoring.<universeDomain>:443`, derived from `setUniverseDomain(...)` / `globalClientConfigs.universeDomain` / `-DuniverseDomain`, `GOOGLE_CLOUD_UNIVERSE_DOMAIN`, or `googleapis.com`. | ||
| - **Automatically disabled modes**: Even when `enableBuiltInMetrics` is `true`, built-in metrics are automatically disabled (no-op with a warning log) when using plaintext connections (`usePlainText`), Spanner Omni (`InstanceType.OMNI` or `experimentalHostEndpoint`), `NoCredentials`, a custom `TransportChannelProvider`, the Spanner emulator (`SPANNER_EMULATOR_HOST`), or a custom non-default Spanner endpoint. |
Contributor
There was a problem hiding this comment.
nit: see my comment regarding SPANNER_EMULATOR_HOST on the other PR
Contributor
Author
There was a problem hiding this comment.
Updated to match #442 and removed SPANNER_EMULATOR_HOST from the list.
…se-domain-and-default-endpoints
…se-domain-and-default-endpoints
sakthivelmanii
merged commit Dec 4, 2026
7a111e0
into
fix/disable-metrics-unsupported-modes
15 checks passed
sakthivelmanii
added a commit
that referenced
this pull request
Dec 4, 2026
…es (#442) * fix: disable built-in metrics for unsupported and custom-endpoint modes * test: avoid mocking TransportChannelProvider on JDK 8 * Addressed comments * feat: add universeDomain support and remove hardcoded spanner.googleapis.com endpoint (#443) * feat: add universeDomain support and remove hardcoded spanner.googleapis.com endpoint * Addressed comments * Addressed comments
sakthivelmanii
added a commit
that referenced
this pull request
Dec 4, 2026
….com endpoint (#441) * fix: propagate credentials and remove hardcoded monitoring.googleapis.com endpoint - Updated BuiltInMetricsProvider.createMetricsRecorder(...) to accept caller Credentials and an optional universeDomain and configure the exporter via GAX MetricServiceSettings instead of a hardcoded monitoring.googleapis.com:443 endpoint (also removing the hardcoded endpoint from the legacy getOrCreateOpenTelemetry(...) path). - Scoped unscoped GoogleCredentials to Monitoring default service scopes when createScopedRequired() is true, preserved already-scoped and custom Credentials, and returned a no-op recorder when NoCredentials is provided or MetricServiceSettings initialization fails with IOException. - Propagated configured credentials from SpannerCqlSessionBuilder (and null for ADC from Launcher) into createMetricsRecorder(...). * test: avoid mocking Credentials on JDK 8 * Addressed comments * fix: disable built-in metrics for unsupported and custom-endpoint modes (#442) * fix: disable built-in metrics for unsupported and custom-endpoint modes * test: avoid mocking TransportChannelProvider on JDK 8 * Addressed comments * feat: add universeDomain support and remove hardcoded spanner.googleapis.com endpoint (#443) * feat: add universeDomain support and remove hardcoded spanner.googleapis.com endpoint * Addressed comments * Addressed comments
sakthivelmanii
added a commit
that referenced
this pull request
Dec 4, 2026
…440) * refactor: use per-adapter SdkMeterProvider with bounded lifecycle cleanup - Added BuiltInMetricsProvider.createMetricsRecorder(...) (@internalapi) to create a dedicated per-adapter SdkMeterProvider with a unique client_uid and matching client_hash per adapter, lazily caching GCP resource attribute detection while retaining getOrCreateOpenTelemetry(...) for binary compatibility. - Added an idempotent, 2-second bounded close() lifecycle method to BuiltInMetricsRecorder and wired cleanup into Adapter.stop(), Adapter.start() failure paths, SpannerCqlSessionBuilder, and Launcher. - Updated Launcher.shutdown() to catch Exception per adapter so partial startup failures still stop all healthy listeners cleanly while letting fatal JVM Errors propagate. * Addressed comments * Addressed comments * fix: propagate credentials and remove hardcoded monitoring.googleapis.com endpoint (#441) * fix: propagate credentials and remove hardcoded monitoring.googleapis.com endpoint - Updated BuiltInMetricsProvider.createMetricsRecorder(...) to accept caller Credentials and an optional universeDomain and configure the exporter via GAX MetricServiceSettings instead of a hardcoded monitoring.googleapis.com:443 endpoint (also removing the hardcoded endpoint from the legacy getOrCreateOpenTelemetry(...) path). - Scoped unscoped GoogleCredentials to Monitoring default service scopes when createScopedRequired() is true, preserved already-scoped and custom Credentials, and returned a no-op recorder when NoCredentials is provided or MetricServiceSettings initialization fails with IOException. - Propagated configured credentials from SpannerCqlSessionBuilder (and null for ADC from Launcher) into createMetricsRecorder(...). * test: avoid mocking Credentials on JDK 8 * Addressed comments * fix: disable built-in metrics for unsupported and custom-endpoint modes (#442) * fix: disable built-in metrics for unsupported and custom-endpoint modes * test: avoid mocking TransportChannelProvider on JDK 8 * Addressed comments * feat: add universeDomain support and remove hardcoded spanner.googleapis.com endpoint (#443) * feat: add universeDomain support and remove hardcoded spanner.googleapis.com endpoint * Addressed comments * Addressed comments
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.
Problem Statement
spannerEndpointtospanner.googleapis.com:443and unconditionally calledAdapterSettings.Builder.setEndpoint(...), preventing GAX from derivingspanner.<universeDomain>:443when a custom Cloud universe domain was configured.universeDomainconsistently across both Spanner and built-in metrics.Solution
universeDomainconfiguration acrossSpannerCqlSessionBuilder.setUniverseDomain(...),globalClientConfigs.universeDomain(YAML), and-DuniverseDomain(system properties), withexplicit > GOOGLE_CLOUD_UNIVERSE_DOMAIN > googleapis.comprecedence, outer-whitespace trimming, and fail-closed validation on blank or internal-whitespace values (plus blankspannerEndpoint/hostvalidation).spanner.googleapis.com:443defaults fromAdapterOptions,LauncherConfig, andSpannerCqlSessionBuildersoAdapteronly callsAdapterSettings.Builder.setEndpoint(...)when explicitly overridden, allowing GAX to derivespanner.<universeDomain>:443while preserving explicit custom endpoints.universeDomainintoBuiltInMetricsSupportandBuiltInMetricsProvider.createMetricsRecorder(...)so both Spanner and Cloud Monitoring endpoints (monitoring.<universeDomain>:443) match the configured universe domain, and documented the behavior indocs/client-side-metrics.mdanddocs/config-options.md.