Repository navigation
fix(logging): honor universe_domain in HTTP transport - #19173
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for universe domains in the Google Cloud Logging Python client. It updates the Client class to determine and store the universe domain from client options or the GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable, and modifies the Connection class to construct the API endpoint dynamically based on this domain. Comprehensive unit tests have been added to verify this behavior, including precedence rules and error handling. The review feedback points out a potential issue in _http.py where getattr might return None or an empty string if the attribute is explicitly set to those values, and suggests using a safer fallback pattern to ensure DEFAULT_UNIVERSE is used.
coryan
left a comment
There was a problem hiding this comment.
Nothing obviously bad jumps at me. Looks like we have the right tests too. But I am terrible at Python (and at many other languages).
🤖 I have created a release *beep* *boop* --- ## [3.17.1](google-cloud-logging-v3.17.0...google-cloud-logging-v3.17.1) (2026-11-22) ### Bug Fixes * **logging:** honor universe_domain in HTTP transport ([#19173](#19173)) ([1663b4b](1663b4b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Summary
google.cloud.logging_v2.Clientforwardedclient_optionsto the GAPIC client in gRPC mode, but its HTTPConnectionhardcodedhttps://logging.googleapis.comunlessclient_options.api_endpointwas explicitly provided—ignoring bothclient_options.universe_domainand theGOOGLE_CLOUD_UNIVERSE_DOMAINenvironment variable.Changes
Client.universe_domainviagoogle.api_core.universe.determine_domain()Connectioningoogle.cloud.logging_v2._httpto deriveAPI_BASE_URLfromhttps://logging.{universe_domain}whenapi_endpointis not explicitly overridden