-
Notifications
You must be signed in to change notification settings - Fork 99
feat(spanner): log client configuration at startup #1461
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @sinhasubham, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new feature to the Spanner client library that logs its configuration details upon initialization. This enhancement aims to improve the user experience by providing immediate and clear insight into the client's operational parameters, which is invaluable for diagnosing issues and confirming desired settings. The change also contributes to greater consistency across Google Cloud client libraries by mirroring functionality already present in the Java Spanner client. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
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 logging for Spanner client options at startup, which is a great enhancement for debuggability. The implementation is mostly solid, and the tests are comprehensive. However, I've found a critical bug due to a function name typo that will cause a NameError on client initialization. I've also provided a suggestion to improve the clarity of the host resolution logic. Once the critical issue is addressed, this will be a valuable addition.
a242170 to
c4eecec
Compare
google/cloud/spanner_v1/client.py
Outdated
| if self._emulator_host: | ||
| host = self._emulator_host | ||
| elif self._experimental_host: | ||
| host = self._experimental_host | ||
| elif self._client_options and self._client_options.api_endpoint: | ||
| host = self._client_options.api_endpoint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emulator host must be getting set somewhere else in the client object, Can't we reuse it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could't find emulator already getting set anywhere already but i have moved this logic to client init and added the host value in client object for future reusability.
c4eecec to
ae9d626
Compare
|
|
||
| self._log_spanner_options() | ||
|
|
||
| def _log_spanner_options(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have decided not to enable it by default in Go and Node. We should follow the similar approach here. It can enabled through ENV.
@surbhigarg92 your thoughts here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, lets do the same. We have already received customer issues in Node and Go. Add it behind a ENV same as Go. I feel only one ENV is enough GOOGLE_CLOUD_SPANNER_ENABLE_LOG_CLIENT_OPTIONS
This change introduces logging for Spanner client options upon initialization.
This allows customers to easily capture and inspect the configuration being used, which is valuable for debugging and verification.
This feature mirrors the existing logSpannerOptions functionality in the Java client, improving consistency across client libraries. googleapis/java-spanner#4141