Skip to content

Instrument write flows with OpenTelemetry traces#4506

Closed
thrivikram-karur-g wants to merge 4 commits intomasterfrom
jules-write-flow-traces-17287576163767606080
Closed

Instrument write flows with OpenTelemetry traces#4506
thrivikram-karur-g wants to merge 4 commits intomasterfrom
jules-write-flow-traces-17287576163767606080

Conversation

@thrivikram-karur-g
Copy link
Copy Markdown
Contributor

This submission adds OpenTelemetry tracing to the file write paths (staged and streaming) as well as generating documentation around it.


PR created automatically by Jules for task 17287576163767606080 started by @thrivikram-karur-g

Adds new traces to the write flow paths in GCSFuse, including both
the legacy staged writes and the new streaming writes. This enables
better observability into performance bottlenecks during write
operations and file synchronization.

A new documentation file, docs/write-flow-traces.md, was also added
to guide users on how to use these new spans for debugging common
performance scenarios related to GCSFuse write behavior.

Co-authored-by: thrivikram-karur-g <235283545+thrivikram-karur-g@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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!

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


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

@thrivikram-karur-g thrivikram-karur-g requested a review from a team as a code owner March 20, 2026 07:46
@github-actions github-actions Bot added the remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR. label Mar 20, 2026
@github-actions
Copy link
Copy Markdown

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Instrument write flows with OpenTelemetry traces". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 significantly enhances GCSFuse's observability by integrating OpenTelemetry tracing into its file write mechanisms. This provides critical insights into the performance characteristics of both staged and streaming write operations, enabling more effective diagnosis of latency issues and operational anomalies. The accompanying documentation serves as a guide for leveraging these new traces to troubleshoot common scenarios, improving the overall debuggability of write flows.

Highlights

  • OpenTelemetry Tracing: Implemented OpenTelemetry tracing for GCSFuse's file write paths, covering both staged and streaming write operations.
  • Enhanced Debugging: Introduced new traces to aid in debugging performance issues, local buffering latency, out-of-order write fallbacks, and GCS upload times.
  • Comprehensive Documentation: Added a new documentation file (docs/write-flow-traces.md) detailing the new traces, their components, descriptions, and common debugging scenarios.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a 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 documentation for OpenTelemetry traces in GCSFuse's write flows. The new documentation is clear, well-structured, and provides valuable guidance for debugging performance issues related to file writes. I've provided a couple of suggestions to improve the consistency and accuracy of the trace descriptions and their usage in the debugging scenarios.

Comment thread docs/write-flow-traces.md
| `fs.file.write.staged` | `internal/fs/inode/file.go` | Traces a write operation using the legacy staged writes (`writeUsingTempFile`). | Understanding the latency of writing to the local temporary file buffer, distinguishing it from streaming writes latency. |
| `fs.file.write.streaming` | `internal/fs/inode/file.go` | Traces a write operation using the buffered writes handler (`writeUsingBufferedWrites`). | Tracking the time taken to buffer the write locally before uploading. Helps identify if the buffer pool is exhausted and the write is blocking. |
| `fs.file.sync.staged` | `internal/fs/inode/file.go` | Traces the synchronization of the staged temp file to GCS (`syncUsingContent`). | Measuring the total time taken to upload the staged file to GCS. Helps distinguish local write time from upload time, identifying slow GCS connections. |
| `fs.file.sync.streaming` | `internal/fs/inode/file.go` | Traces the synchronization of buffered writes to GCS (`SyncPendingBufferedWrites`). | Measuring the time waiting for in-flight streaming blocks to finish uploading to GCS during a file sync or close. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The description for fs.file.sync.streaming seems a bit too specific, mentioning only SyncPendingBufferedWrites. The fallback scenario on line 29 implies that flushUsingBufferedWriteHandler is also covered by this trace. To improve clarity, I suggest broadening the description to include other synchronization scenarios for streaming writes.

Suggested change
| `fs.file.sync.streaming` | `internal/fs/inode/file.go` | Traces the synchronization of buffered writes to GCS (`SyncPendingBufferedWrites`). | Measuring the time waiting for in-flight streaming blocks to finish uploading to GCS during a file sync or close. |
| `fs.file.sync.streaming` | `internal/fs/inode/file.go` | Traces the synchronization of buffered writes to GCS (e.g., `SyncPendingBufferedWrites`, `flushUsingBufferedWriteHandler`). | Measuring the time waiting for in-flight streaming blocks to finish uploading to GCS during a file sync or close. |

Comment thread docs/write-flow-traces.md

### 2. High latency during file close/sync
* **Symptom:** Saving a file takes a long time, freezing the application briefly.
* **Trace Analysis:** Check `fs.file.sync.staged` and `fs.file.sync.streaming`. High latency in `SyncFileStaged` means the entire file is being uploaded to GCS at the time of closing. High latency in `SyncFileStreaming` indicates that the background upload process is slow, or `StreamingUploadFinalize` is blocking waiting for blocks. Check `streaming.block.upload` for individual block latencies.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better clarity and consistency, it's best to use the exact trace names (wrapped in backticks) as defined in the table when discussing them in the analysis. This helps users quickly identify the correct spans in their tracing tool.

Suggested change
* **Trace Analysis:** Check `fs.file.sync.staged` and `fs.file.sync.streaming`. High latency in `SyncFileStaged` means the entire file is being uploaded to GCS at the time of closing. High latency in `SyncFileStreaming` indicates that the background upload process is slow, or `StreamingUploadFinalize` is blocking waiting for blocks. Check `streaming.block.upload` for individual block latencies.
* **Trace Analysis:** Check `fs.file.sync.staged` and `fs.file.sync.streaming`. High latency in `fs.file.sync.staged` means the entire file is being uploaded to GCS at the time of closing. High latency in `fs.file.sync.streaming` indicates that the background upload process is slow, or `streaming.upload.finalize` is blocking waiting for blocks. Check `streaming.block.upload` for individual block latencies.

google-labs-jules Bot and others added 2 commits March 20, 2026 08:01
Adds new traces to the write flow paths in GCSFuse, including both
the legacy staged writes and the new streaming writes. This enables
better observability into performance bottlenecks during write
operations and file synchronization.

A new documentation file, docs/write-flow-traces.md, was also added
to guide users on how to use these new spans for debugging common
performance scenarios related to GCSFuse write behavior.

Co-authored-by: thrivikram-karur-g <235283545+thrivikram-karur-g@users.noreply.github.com>
Adds new traces to the write flow paths in GCSFuse, including both
the legacy staged writes and the new streaming writes. This enables
better observability into performance bottlenecks during write
operations and file synchronization.

A new documentation file, docs/write-flow-traces.md, was also added
to guide users on how to use these new spans for debugging common
performance scenarios related to GCSFuse write behavior.

Co-authored-by: thrivikram-karur-g <235283545+thrivikram-karur-g@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 92.68293% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.72%. Comparing base (8b5e5de) to head (0c57ffb).
⚠️ Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
internal/bufferedwrites/upload_handler.go 92.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4506      +/-   ##
==========================================
+ Coverage   83.67%   83.72%   +0.04%     
==========================================
  Files         163      163              
  Lines       20089    20112      +23     
==========================================
+ Hits        16810    16838      +28     
+ Misses       2653     2650       -3     
+ Partials      626      624       -2     
Flag Coverage Δ
unittests 83.72% <92.68%> (+0.04%) ⬆️

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.

Adds new traces to the write flow paths in GCSFuse, including both
the legacy staged writes and the new streaming writes. This enables
better observability into performance bottlenecks during write
operations and file synchronization.

A new documentation file, docs/write-flow-traces.md, was also added
to guide users on how to use these new spans for debugging common
performance scenarios related to GCSFuse write behavior.

Co-authored-by: thrivikram-karur-g <235283545+thrivikram-karur-g@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

Hi @raj-prince, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@thrivikram-karur-g
Copy link
Copy Markdown
Contributor Author

Closing this as raising a new cleaner pull request for the write traces

@google-labs-jules
Copy link
Copy Markdown
Contributor

Closing this as raising a new cleaner pull request for the write traces

Understood. Acknowledging that this work is now obsolete and stopping work on this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant