fix thread Local metrics (#1621)#1647
Conversation
|
/gcbrun |
Summary of ChangesHello, 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 resolves an issue where thread-local metrics were not being properly accounted for in scenarios involving multi-threaded operations, specifically during vectored reads. The changes introduce a robust system for collecting and consolidating these metrics from individual worker threads, ensuring that the overall statistics accurately reflect the complete I/O activity. This enhancement improves the reliability and completeness of performance monitoring for concurrent file system operations. 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. Changelog
Activity
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.
Code Review
This pull request aims to fix thread-local metrics collection for vectored reads by introducing a mechanism to aggregate stats from worker threads and merge them into the main thread's statistics. While the overall approach is sound and correctly handles single-range vectored reads, I've identified a critical issue in how statistics are collected for combined (merged) ranges. This bug will result in incorrect metrics being reported.
| storageStatistics.incrementCounter( | ||
| GhfsStatistic.STREAM_READ_VECTORED_EXTRA_READ_BYTES, discardedBytes); | ||
|
|
||
| captureAndResetThreadLocalStats(); |
There was a problem hiding this comment.
The call to captureAndResetThreadLocalStats() is incorrectly placed inside the loop over child ranges and, more importantly, before updateBytesRead(). This will lead to incorrect metrics.
Specifically:
- The statistics from the GCS API call (e.g.,
GCS_GET_MEDIA_REQUEST) will only be captured for the first child range and then reset, being lost for subsequent child ranges in the same combined block. - The
STREAM_READ_BYTESstatistic, which is updated inupdateBytesRead(), will not be captured at all becausecaptureAndResetThreadLocalStats()is called before it.
To fix this, captureAndResetThreadLocalStats() should be moved out of the for loop and placed after it, but before combinedFileRange.getData().complete(readContent). This ensures all statistics for the combined read are accumulated before being captured.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## branch-3.1.x #1647 +/- ##
===============================================
Coverage ? 82.65%
Complexity ? 2344
===============================================
Files ? 124
Lines ? 10359
Branches ? 1256
===============================================
Hits ? 8562
Misses ? 1277
Partials ? 520
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|



No description provided.