Add split phase metrics for filestream fsync operations - #10493
Merged
valyala merged 5 commits intoApr 2, 2026
Conversation
## Summary This PR implements split phase metrics for filestream operations as requested in VictoriaMetrics#10432. ### Changes - Added `vm_filestream_fsync_duration_seconds_total` metric to track fsync syscall duration separately - Added `vm_filestream_fsync_calls_total` metric to count fsync calls - Added `vm_filestream_write_syscall_duration_seconds_total` metric to track write syscall duration (previously mixed with flush time) - Refactored `MustClose()` and `MustFlush()` to use new `flush()` and `sync()` helper methods - Kept `vm_filestream_write_duration_seconds_total` for backward compatibility ### Problem Solved Previously, `vm_filestream_write_duration_seconds_total` was being incremented in two places: 1. `statWriter.Write()` - triggered by `bw.Flush()` and `bw.Write()` 2. `Writer.MustFlush()` - which included the above process, leading to double-counting This made it impossible to distinguish between write syscall time and fsync time, which is critical for diagnosing storage latency issues. ### Solution The new metrics allow users to: - Distinguish "flush got slower" vs "fsync got slower" using metrics only - No file path labels (bounded cardinality) - No double-counting between metrics Closes VictoriaMetrics#10432
Signed-off-by: Aliaksandr Valialkin <[email protected]>
valyala
approved these changes
Apr 2, 2026
Signed-off-by: Aliaksandr Valialkin <[email protected]>
Signed-off-by: Aliaksandr Valialkin <[email protected]>
Collaborator
|
@mehrdadbn9 , thank you for the pull request! |
valyala
added a commit
that referenced
this pull request
Apr 2, 2026
## Summary This PR implements split phase metrics for filestream operations as requested in #10432. ### Changes - Added `vm_filestream_fsync_duration_seconds_total` metric to track fsync syscall duration separately - Added `vm_filestream_fsync_calls_total` metric to count fsync calls - Added `vm_filestream_write_syscall_duration_seconds_total` metric to track write syscall duration (previously mixed with flush time) - Refactored `MustClose()` and `MustFlush()` to use new `flush()` and `sync()` helper methods - Kept `vm_filestream_write_duration_seconds_total` for backward compatibility ### Problem Solved Previously, `vm_filestream_write_duration_seconds_total` was being incremented in two places: 1. `statWriter.Write()` - triggered by `bw.Flush()` and `bw.Write()` 2. `Writer.MustFlush()` - which included the above process, leading to double-counting This made it impossible to distinguish between write syscall time and fsync time, which is critical for diagnosing storage latency issues. ### Solution The new metrics allow users to: - Distinguish "flush got slower" vs "fsync got slower" using metrics only - No file path labels (bounded cardinality) - No double-counting between metrics ### Testing - Code compiles successfully - All existing metrics are preserved for backward compatibility Closes #10432 --------- Signed-off-by: Aliaksandr Valialkin <[email protected]> Signed-off-by: Aliaksandr Valialkin <[email protected]> Co-authored-by: Aliaksandr Valialkin <[email protected]> Co-authored-by: Aliaksandr Valialkin <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements split phase metrics for filestream operations as requested in #10432.
Changes
vm_filestream_fsync_duration_seconds_totalmetric to track fsync syscall duration separatelyvm_filestream_fsync_calls_totalmetric to count fsync callsvm_filestream_write_syscall_duration_seconds_totalmetric to track write syscall duration (previously mixed with flush time)MustClose()andMustFlush()to use newflush()andsync()helper methodsvm_filestream_write_duration_seconds_totalfor backward compatibilityProblem Solved
Previously,
vm_filestream_write_duration_seconds_totalwas being incremented in two places:statWriter.Write()- triggered bybw.Flush()andbw.Write()Writer.MustFlush()- which included the above process, leading to double-countingThis made it impossible to distinguish between write syscall time and fsync time, which is critical for diagnosing storage latency issues.
Solution
The new metrics allow users to:
Testing
Closes #10432