-
Notifications
You must be signed in to change notification settings - Fork 2k
fix(incremental_to_absolute transform): fix LRU cache memory handling and emit cache metrics #24116
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
base: master
Are you sure you want to change the base?
fix(incremental_to_absolute transform): fix LRU cache memory handling and emit cache metrics #24116
Conversation
|
@pront @thomasqueirozb Hey what's the timeline on which you can have a look/get this approved? |
| let mut interval = tokio::time::interval(Duration::from_secs(2)); | ||
|
|
||
| Box::pin(task.filter_map(move |v| { | ||
| let mut cx = std::task::Context::from_waker(futures::task::noop_waker_ref()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we have two better options:
- Spawn a background task to do the reporting (requires synchronization and graceful shutdown)
- or implement this pattern:
loop {
tokio::select! {
_ = interval.tick() => {
inner.emit_metrics();
},
maybe_event = task.next() => { // ...| impl ByteSizeOf for Sample { | ||
| fn allocated_bytes(&self) -> usize { | ||
| 0 | ||
| size_of::<Self>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The allocated_bytes() method should return only heap-allocated memory, excluding stack memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's your suggested fix here? If we set it to 0 as it is before the memory tracking won't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably use .size_of() in item_size() but I am going based on pub trait ByteSizeOf, didn't have time to dig into this PR.
|
@pront should be fixed now |
|
@pront bump |
|
@pront @thomasqueirozb Bump can you guys have a look please? |
Summary
incremental_to_absolute,absolute_to_incremental, and LRU cache capacity policy behaviorVector configuration
I then ran a statsd firehose to send arbitrary metrics to s0: https://github.com/stvp/statsd-firehose
How did you test this PR?
Memory usage w/ continual statsd pushes on a real deployment:

vector_component_allocated_bytes:

New metrics:



Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.make fmtmake check-clippy(if there are failures it's possible some of them can be fixed withmake clippy-fix)make testgit merge origin masterandgit push.Cargo.lock), pleaserun
make build-licensesto regenerate the license inventory and commit the changes (if any). More details here.