Skip to content

Conversation

@7suyash7
Copy link
Contributor

Implement statistics tracking for the SubSocket, #37

Add a new SocketWideStats struct to hold metrics related to
the overall socket operation, distinct from per-publisher stats. Includes counters for:

  • Messages dropped due to a full ingress buffer (driver -> socket)
  • Messages successfully received by the socket frontend from the driver

Copy link
Contributor

@mempirate mempirate left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I've got a small suggestion

}

#[derive(Debug, Default)]
pub struct SocketWideStats {
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed with having socket-agnostic stats for shared metrics, but I would like to see it implemented differently, something like the following:

struct SocketStats<S> {
   // ... socket-wide stats, and
   substats: S,
}

Where S = a stats struct specific to the socket implementation, for example SubStats or PubStats.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @mempirate yeah a unified structure makes sense. Just want to clarify though:
Are you thinking of a struct like maybe SocketStats<SpecificStats> (eg. SocketStats) where specific SpecificStats (like SubStats) hold the implementation specific details like the session map and the new counters like dropped_messages_total for Sub? And for this specific PR should I only refactor the SubSocket stats into this new pattern, leaving the refactor of Pub/Rep/Req stats for future work ? I'm happy to do a big refactor if thats preferred!

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that's right! And would be great if you'd want to do this across the different socket types so we don't get any inconsistencies

@7suyash7
Copy link
Contributor Author

Hi! @mempirate, can you please take a look

Copy link
Contributor

@mempirate mempirate left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the contribution :)

@mempirate mempirate merged commit 036a1b4 into chainbound:main Apr 23, 2025
3 checks passed
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.

2 participants