-
Notifications
You must be signed in to change notification settings - Fork 61
[DRAFT] feat: added client side metric instrumentation to read_rows and mutate_rows #1256
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: csm_2_instrumentation
Are you sure you want to change the base?
[DRAFT] feat: added client side metric instrumentation to read_rows and mutate_rows #1256
Conversation
This reverts commit d3a9013.
Summary of ChangesHello @daniel-sanche, 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 enhances the Bigtable client library by integrating robust client-side metric instrumentation. It provides granular insights into the performance and behavior of Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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 client-side metric instrumentation for read_rows and mutate_rows operations, which is a valuable addition for monitoring and performance analysis. The changes are well-structured, using a tracked_retry wrapper to cleanly inject metrics logic into existing retry mechanisms. The refactoring of read_row and row_exists methods in the client is a good improvement, enhancing code reuse and ensuring consistent metric coverage. The new system tests are comprehensive and cover a wide range of success and failure scenarios, which is excellent. I have a couple of minor suggestions to improve code clarity by removing a type: ignore directive. Overall, this is a solid contribution.
| if self._operation_metric.active_attempt is not None: | ||
| self._operation_metric.active_attempt.application_blocking_time_ns += ( # type: ignore | ||
| time.monotonic_ns() - block_time | ||
| ) |
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.
To improve readability and avoid the type: ignore, you could introduce a local variable for self._operation_metric.active_attempt. This helps the type checker understand that the object is not None within the conditional block.
active_attempt = self._operation_metric.active_attempt
if active_attempt is not None:
active_attempt.application_blocking_time_ns += (
time.monotonic_ns() - block_time
)| if self._operation_metric.active_attempt is not None: | ||
| self._operation_metric.active_attempt.application_blocking_time_ns += ( | ||
| time.monotonic_ns() - block_time | ||
| ) |
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.
For consistency and improved readability, you could introduce a local variable for self._operation_metric.active_attempt here as well. This makes the logic clearer and aligns it with the suggested change in the async version of this file.
active_attempt = self._operation_metric.active_attempt
if active_attempt is not None:
active_attempt.application_blocking_time_ns += (
time.monotonic_ns() - block_time
)
Builds off of #1188 to add instrumentation to read_rows and mutate_rows, along with the mutation batcher