-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add a basic metric for tracking the capacity in VecDeque buffer #383
Conversation
rust-arroyo/src/processing/dlq.rs
Outdated
if metric_prob <= 0.01 { | ||
// Number of partitions in the buffer map | ||
gauge!( | ||
"arroyo.consumer.dlq_buffer.assigned_partitions", | ||
self.buffered_messages.len() as u64, | ||
); | ||
} | ||
|
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.
This pattern is repeated several times. Can this be moved to a function?
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.
I didn't notice this code. In fact, this sampling should not be required at all. it has some performance benefits in python but they should not be present for rust. let's remove the sampling entirely.
rust-arroyo/src/processing/dlq.rs
Outdated
if metric_prob <= 0.01 { | ||
// Number of partitions in the buffer map | ||
gauge!( | ||
"arroyo.consumer.dlq_buffer.assigned_partitions", | ||
self.buffered_messages.len() as u64, | ||
); | ||
} | ||
|
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.
I didn't notice this code. In fact, this sampling should not be required at all. it has some performance benefits in python but they should not be present for rust. let's remove the sampling entirely.
We can also measure the length of the queue, but as far as I can tell
VecDeque
only really has thecapacity()
function.If we see this metric drop to 0 and then spike up to a new very high value, we would be able to detect the scenario where the buffer is being reallocated. Not sure if we need anything more complicated than this since we have the mutable buffer being accessed in both of these functions anyways and we can just check in these functions.
Also tracks the number of partitions in the BTreeMap