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

feat: track buffered outgoing messages #12220

Merged

Conversation

caglaryucekaya
Copy link
Contributor

Closes #12203

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits

Comment on lines 772 to 777
pub fn push_back(&mut self, message: OutgoingMessage) {
self.messages.push_back(message);
self.count.increment(1);
}

pub fn pop_front(&mut self) -> Option<OutgoingMessage> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can also make this pub crate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 778 to 781
let message = self.messages.pop_front();
if message.is_some() {
self.count.decrement(1);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can solve this with Option::inspect

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +762 to +765
pub(crate) struct QueuedOutgoingMessages {
messages: VecDeque<OutgoingMessage>,
count: Gauge,
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could use a one line doc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


pub(crate) struct QueuedOutgoingMessages {
messages: VecDeque<OutgoingMessage>,
count: Gauge,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at the ordering in Gaugefn impl for Atomic I believe this should work and not result in overflows

@mattsse mattsse added the A-observability Related to tracing, metrics, logs and other observability tools label Oct 31, 2024
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mattsse mattsse added this pull request to the merge queue Nov 1, 2024
Merged via the queue into paradigmxyz:main with commit 927be85 Nov 1, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-observability Related to tracing, metrics, logs and other observability tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Track buffered outgoing p2p messages with a new metric
2 participants