Skip to content
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

Merged
merged 9 commits into from
Sep 11, 2024

Conversation

ayirr7
Copy link
Member

@ayirr7 ayirr7 commented Aug 27, 2024

We can also measure the length of the queue, but as far as I can tell VecDeque only really has the capacity() 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

@ayirr7 ayirr7 changed the title Add metrics around buffered msgs Add a simple metric for tracking the capacity in VecDeque Aug 27, 2024
@ayirr7 ayirr7 changed the title Add a simple metric for tracking the capacity in VecDeque Add a basic metric for tracking the capacity in VecDeque Aug 27, 2024
@ayirr7 ayirr7 marked this pull request as ready for review August 27, 2024 23:53
@ayirr7 ayirr7 requested review from a team as code owners August 27, 2024 23:53
@ayirr7 ayirr7 changed the title Add a basic metric for tracking the capacity in VecDeque Add a basic metric for tracking the capacity in VecDeque buffer Aug 27, 2024
@ayirr7 ayirr7 requested a review from untitaker August 28, 2024 06:06
Comment on lines 411 to 418
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,
);
}

Copy link
Member

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?

Copy link
Member

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.

Comment on lines 411 to 418
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,
);
}

Copy link
Member

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.

@ayirr7 ayirr7 merged commit ca204da into main Sep 11, 2024
13 checks passed
@ayirr7 ayirr7 deleted the add-metrics-around-buffered-msgs branch September 11, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants