Repository navigation
enhancement(buffers): improve disk buffer lifecycle visibility #26050
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
Open
Jansen-w
wants to merge
37
commits into
vectordotdev:master
Choose a base branch
from
Jansen-w:fix/disk-buffer-orphan-safety
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+764
−9
Open
Changes from 34 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
40aa9b9
enhancement(buffers): track unread disk usage
Jansen-w 8cda89c
enhancement(topology): report disk buffer reload behavior
Jansen-w 7b9f6e0
enhancement(config): detect unreferenced disk buffers
Jansen-w 2163401
refactor(topology): simplify disk buffer lifecycle diagnostics
Jansen-w 105a472
fix(topology): resolve disk buffer drain conflicts
Jansen-w 3301482
fix(topology): report busy disk buffer drains
Jansen-w 75d89e6
fix(topology): match canonical drain paths
Jansen-w 4ebd182
fix(topology): synchronize orphan scan reporting
Jansen-w d1f5f8b
fix(topology): avoid blocking scan scheduling
Jansen-w 3c80414
fix(topology): resolve drain paths off runtime
Jansen-w 8dfe515
Merge master and resolve disk buffer lifecycle conflicts
Jansen-w c7b01c7
Merge remote-tracking branch 'origin/master' into fix/disk-buffer-orp…
Jansen-w dae02c6
docs(buffers): clarify usage snapshot semantics
Jansen-w 6b1e979
test(topology): harden disk lifecycle shutdown checks
Jansen-w 3e63ab3
fix(topology): clarify replaced disk buffer warning
Jansen-w 9354d15
fix(topology): ignore vanished buffer files
Jansen-w 4769361
refactor(topology): simplify orphan buffer scans
Jansen-w 5b44400
refactor(topology): reuse active buffer discovery
Jansen-w 57f4a32
fix(topology): release completed disk drain outputs
Jansen-w 6a2fe4c
fix(buffers): await disk finalizers before reopen
Jansen-w 7c9f867
fix(topology): rescan buffers after reload
Jansen-w c3648a8
fix(buffers): quiesce cleanup before reopen
Jansen-w a07e9d3
fix(topology): release buffers on failed builds
Jansen-w cf02daa
refactor(buffers): unify disk task lifecycle
Jansen-w 5619bb4
refactor(topology): keep disk diagnostics non-invasive
Jansen-w 78a4ddf
fix(topology): warn when replacement usage is unavailable
Jansen-w 2cf7fc5
docs(topology): clarify detached buffer drains
Jansen-w 061e707
test(topology): trim orphan scanner coverage
Jansen-w eeb09bf
fix(topology): correct disk diagnostics
Jansen-w fce10c1
test(buffers): use conventional module name
Jansen-w 13ae326
fix(topology): conservatively exclude configured buffers
Jansen-w e101083
enhancement(topology): emit disk lifecycle metrics
Jansen-w 798fc42
fix(topology): add disk lifecycle internal events
Jansen-w bf3c163
enhancement(topology): emit disk lifecycle metrics
Jansen-w 43cc059
fix(metrics): namespace disk lifecycle counter
Jansen-w c3c6e32
fix(topology): make replacement diagnostics conservative
Jansen-w 3cacfdb
fix(topology): clarify disk buffer lifecycle messages
Jansen-w File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Vector now detects unreferenced disk buffers and reports disk-buffer lifecycle events during configuration reloads through logs and the `disk_buffer_lifecycle_events_total` counter. | ||
|
|
||
| authors: Jansen-w |
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| use std::path::{Path, PathBuf}; | ||
|
|
||
| use vector_lib::{ | ||
| NamedInternalEvent, | ||
| buffers::DiskBufferUsageSnapshot, | ||
| config::ComponentKey, | ||
| counter, | ||
| internal_event::{CounterName, InternalEvent}, | ||
| }; | ||
|
|
||
| #[derive(Debug, NamedInternalEvent)] | ||
| pub struct TopologyDiskBufferRemoved<'a> { | ||
| pub component_id: &'a ComponentKey, | ||
| pub buffer_dirs: &'a [PathBuf], | ||
| pub usage: Option<DiskBufferUsageSnapshot>, | ||
| pub drain_in_background: bool, | ||
| } | ||
|
|
||
| impl InternalEvent for TopologyDiskBufferRemoved<'_> { | ||
| fn emit(self) { | ||
| let message = match (self.usage.is_some(), self.drain_in_background) { | ||
| (true, true) => { | ||
| "Removing sink with attached disk buffer containing buffered bytes. Its current instance will continue draining in the background until the buffer is empty or Vector shuts down." | ||
| } | ||
| (true, false) => { | ||
| "Removing sink with attached disk buffer containing buffered bytes. Configuration reload will wait for its current instance to drain the buffer." | ||
| } | ||
| (false, true) => { | ||
| "Removing sink with attached disk buffer whose buffered-byte count is unavailable. Its current instance will continue draining in the background until the buffer is empty or Vector shuts down." | ||
| } | ||
| (false, false) => { | ||
| "Removing sink with attached disk buffer whose buffered-byte count is unavailable. Configuration reload will wait for its current instance to drain the buffer." | ||
| } | ||
| }; | ||
| if let Some(usage) = self.usage { | ||
| info!( | ||
| component_id = %self.component_id, | ||
| buffer_dirs = ?self.buffer_dirs, | ||
| buffered_events = usage.event_count, | ||
| buffered_bytes = usage.byte_size, | ||
| drain_in_background = self.drain_in_background, | ||
| message, | ||
| ); | ||
| } else { | ||
| info!( | ||
| component_id = %self.component_id, | ||
| buffer_dirs = ?self.buffer_dirs, | ||
| drain_in_background = self.drain_in_background, | ||
| usage_unavailable = true, | ||
| message, | ||
| ); | ||
| } | ||
| counter!( | ||
| CounterName::DiskBufferLifecycleEventsTotal, | ||
| "event" => "removed", | ||
| ) | ||
| .increment(1); | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug, NamedInternalEvent)] | ||
| pub struct TopologyDiskBufferReplacementUnreferenced<'a> { | ||
| pub component_id: &'a ComponentKey, | ||
| pub buffer_dirs: &'a [PathBuf], | ||
| pub new_buffer_dirs: &'a [PathBuf], | ||
| pub usage: Option<DiskBufferUsageSnapshot>, | ||
| } | ||
|
|
||
| impl InternalEvent for TopologyDiskBufferReplacementUnreferenced<'_> { | ||
| fn emit(self) { | ||
| if let Some(usage) = self.usage { | ||
| warn!( | ||
| component_id = %self.component_id, | ||
| buffer_dirs = ?self.buffer_dirs, | ||
| new_buffer_dirs = ?self.new_buffer_dirs, | ||
| buffered_events = usage.event_count, | ||
| buffered_bytes = usage.byte_size, | ||
| message = "Replacement sink does not use the previous disk buffer. If reload succeeds, its buffered bytes will be left unreferenced.", | ||
| ); | ||
| } else { | ||
| warn!( | ||
| component_id = %self.component_id, | ||
| buffer_dirs = ?self.buffer_dirs, | ||
| new_buffer_dirs = ?self.new_buffer_dirs, | ||
| usage_unavailable = true, | ||
| message = "Replacement sink does not use the previous disk buffer, and its buffered-byte count is unavailable. If reload succeeds, any buffered bytes will be left unreferenced.", | ||
| ); | ||
| } | ||
| counter!( | ||
| CounterName::DiskBufferLifecycleEventsTotal, | ||
| "event" => "replacement_unreferenced", | ||
| ) | ||
| .increment(1); | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug, NamedInternalEvent)] | ||
| pub struct TopologyDiskBufferUnreferenced<'a> { | ||
| pub buffer_id: &'a Path, | ||
| pub buffer_dir: &'a Path, | ||
| } | ||
|
|
||
| impl InternalEvent for TopologyDiskBufferUnreferenced<'_> { | ||
| fn emit(self) { | ||
| warn!( | ||
| buffer_id = self.buffer_id.to_string_lossy().as_ref(), | ||
| buffer_dir = self.buffer_dir.to_string_lossy().as_ref(), | ||
| message = "Found disk buffer not referenced by the current configuration. It may still be draining through a detached sink instance; otherwise its buffered bytes are not being processed.", | ||
| ); | ||
| counter!( | ||
| CounterName::DiskBufferLifecycleEventsTotal, | ||
| "event" => "unreferenced", | ||
| ) | ||
| .increment(1); | ||
| } | ||
| } |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.