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

protocols/gossipsub: Add mesh metrics #2316

Merged
merged 25 commits into from
Nov 16, 2021
Merged

Conversation

divagant-martian
Copy link
Contributor

Small part of #2235
I found it increasingly hard to reason about the correctness of the way we update each metrics with so many metrics at once, so this PR focus only on the mesh related metrics and topic_peer metrics. It also includes #2277

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Sorry for the delay here @divagant-martian. I like the new approach of passing a registry at construction and keeping an Option<Metrics> at runtime.

protocols/gossipsub/src/metrics.rs Outdated Show resolved Hide resolved

// Default value that limits how many topics for which there has been a previous or current
// subscription do we store metrics.
const DEFAULT_MAX_EXPLICITLY_SUBSCRIBED_TOPICS: usize = 300;
Copy link
Member

Choose a reason for hiding this comment

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

While a bit of a hack in my eyes, this seems like a practical solution to the problem of metric churn.

What is your experience with this constant limit? Do you ever hit it on your production nodes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For us the subscriptions that are really important occur at the beginning and are few, this is a very high upper limit. Still, that's why I left it as an application-configurable value

Copy link
Contributor

Choose a reason for hiding this comment

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

We're currently bounded at about 250 topics (we can double our topic subscription around a fork boundary), most operating nodes would have around 125.
I guess we've set this value selfishly around our needs a little, but hopefully is sufficiently large for others.

@@ -302,6 +304,9 @@ pub struct Gossipsub<
/// calculating the message-id and sending to the application. This is designed to allow the
/// user to implement arbitrary topic-based compression algorithms.
data_transform: D,

/// Keep track of a set of internal metrics relating to gossipsub.
metrics: Option<Metrics>,
Copy link
Member

Choose a reason for hiding this comment

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

👍

@divagant-martian
Copy link
Contributor Author

Just solved conflicts with master, in case you can give this a review @mxinden Thx

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

@divagant-martian could you add a changelog entry in protocols/gossipsub/CHANGELOG.md and misc/metrics/CHANGELOG.md?

Other than that, this looks good to me and is ready to be merged.

@divagant-martian
Copy link
Contributor Author

I added the Changelog entries and bumped the version of the metrics toml. I also updated the style of this file to follow the other ones. Let me know if the last two steps were not needed / should be reverted. Thanks!

@mxinden mxinden changed the title Gossip mesh metrics protocols/gossipsub: Add mesh metrics Nov 16, 2021
@mxinden
Copy link
Member

mxinden commented Nov 16, 2021

Max likes final punctuation.

Yes indeed :D

@mxinden mxinden merged commit 2066a19 into libp2p:master Nov 16, 2021
@AgeManning AgeManning deleted the gossip-mesh-metrics branch February 15, 2022 05:25
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