Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

Added a new tool tools/handle_visualizer to visualize file read patterns from GCSFuse logs. The tool parses JSON logs, extracts ReadFile operations, and generates a scatter plot of read offsets versus time for each file handle. It also calculates and prints the percentage of sequential reads for each handle. This helps in diagnosing performance issues related to read patterns (sequential vs random).


PR created automatically by Jules for task 6258556285513807878 started by @Tulsishah

This tool parses GCSFuse logs to visualize read operations for each file handle.
It helps identify if files are being read sequentially or randomly by plotting
read offsets over time. It also provides a textual analysis of sequentiality percentage.

Added:
- tools/handle_visualizer/visualizer.py
- tools/handle_visualizer/README.md
- tools/handle_visualizer/requirements.txt
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@Tulsishah Tulsishah changed the title Add file handle visualizer tool for GCSFuse logs test: Add file handle visualizer tool for GCSFuse logs Dec 30, 2025
google-labs-jules bot and others added 4 commits December 30, 2025 06:21
This tool parses GCSFuse logs to visualize read operations for each file handle.
It helps identify if files are being read sequentially or randomly by plotting
read offsets over time. It also provides a textual analysis of sequentiality percentage.

Added:
- tools/handle_visualizer/visualizer.py
- tools/handle_visualizer/README.md
- tools/handle_visualizer/requirements.txt
This change integrates the file handle visualizer tool directly into GCSFuse.
Users can now enable live visualization of read patterns using the
`--experimental-handle-visualizer` flag.

Details:
- Added `--experimental-handle-visualizer` flag to `cfg/params.yaml`.
- Regenerated config code.
- Embedded the python visualizer script in `cmd/visualizer_script.go`.
- Modified `cmd/mount.go` to:
    - Spawn the python visualizer process when the flag is set.
    - Create a temporary copy of the script.
    - Pipe JSON trace logs to the visualizer asynchronously using `AsyncPipeWriter`.
    - Automatically set log format to JSON and severity to TRACE.
- Modified `internal/logger` to support adding extra writers (for the pipe) dynamically.
- Implemented `AsyncPipeWriter` to prevent GCSFuse from hanging if the visualizer process is slow.

The visualizer helps identify sequential vs random read patterns in real-time.
…iping

This change integrates the file handle visualizer tool directly into GCSFuse.
Users can now enable live visualization of read patterns using the
`--experimental-handle-visualizer` flag.

Details:
- Added `--experimental-handle-visualizer` flag to `cfg/params.yaml`.
- Regenerated config code.
- Embedded the python visualizer script in `cmd/visualizer_script.go`.
- Modified `cmd/mount.go` to:
    - Spawn the python visualizer process when the flag is set.
    - Create a temporary copy of the script.
    - Pipe JSON trace logs to the visualizer asynchronously using `AsyncPipeWriter`.
    - Automatically set log format to JSON and severity to TRACE.
    - Return a cleanup function to properly kill the process on unmount.
- Modified `internal/logger` to support adding extra writers (for the pipe) dynamically.
- Implemented `AsyncPipeWriter` with mutex-protected closing to prevent panics when writing to closed channels during shutdown.
- Modified `cmd/legacy_main.go` to invoke the cleanup function after unmount.

The visualizer helps identify sequential vs random read patterns in real-time.
@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 6.86275% with 95 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.73%. Comparing base (84288e3) to head (8d32b02).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cmd/mount.go 0.00% 76 Missing ⚠️
internal/logger/logger.go 38.88% 8 Missing and 3 partials ⚠️
cmd/legacy_main.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4217      +/-   ##
==========================================
- Coverage   83.09%   82.73%   -0.37%     
==========================================
  Files         153      153              
  Lines       18756    18863     +107     
==========================================
+ Hits        15586    15606      +20     
- Misses       2598     2685      +87     
  Partials      572      572              
Flag Coverage Δ
unittests 82.73% <6.86%> (-0.37%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…port

This change fully integrates the file handle visualizer tool into GCSFuse.
Users can enable live visualization of read patterns using the
`--experimental-handle-visualizer` flag.

Details:
- Added `--experimental-handle-visualizer` flag to `cfg/params.yaml`.
- Embedded the python visualizer script in `cmd/visualizer_script.go`.
- Modified `cmd/mount.go` to:
    - Spawn the python visualizer process.
    - Pipe JSON trace logs asynchronously using `AsyncPipeWriter`.
    - Use `AsyncPipeWriter` with mutex-protected closing to prevent panics.
    - Return a cleanup function to kill the process on unmount.
- Modified `cmd/legacy_main.go` to execute the cleanup function.
- Updated `tools/handle_visualizer/visualizer.py` to support headless (Agg) execution.
- Updated `internal/logger` to support dynamic writers.

The visualizer helps identify sequential vs random read patterns in real-time, working in both interactive and headless environments.
This change integrates the file handle visualizer tool into GCSFuse.
Users can enable live visualization of read patterns using the
`--experimental-handle-visualizer` flag.

The visualization has been updated to plot read ranges (lines from offset to offset+size) against time, making it easier to identify sequential vs random access patterns.

Details:
- Added `--experimental-handle-visualizer` flag to `cfg/params.yaml`.
- Embedded the python visualizer script in `cmd/visualizer_script.go`.
- Modified `cmd/mount.go` to:
    - Spawn the python visualizer process.
    - Pipe JSON trace logs asynchronously using `AsyncPipeWriter`.
    - Use `AsyncPipeWriter` with mutex-protected closing to prevent panics.
    - Return a cleanup function to kill the process on unmount.
- Modified `cmd/legacy_main.go` to execute the cleanup function.
- Updated `tools/handle_visualizer/visualizer.py` to plot ranges and support headless (Agg) execution.
- Updated `internal/logger` to support dynamic writers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant