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/kad: Extend emitted events with basic information #2087

Merged
merged 11 commits into from
Jun 28, 2021

Conversation

mxinden
Copy link
Member

@mxinden mxinden commented May 31, 2021

In order for users of libp2p-kad to gain deeper insights into the current state of the local DHT this pull request extends the events emitted by libp2p-kad with the information below. This is e.g. useful for #2063.

  • protocols/kad: Expose whether routing update is new peer

    Can e.g. be used to count the number of peers in the routing table.

  • protocols/kad: Expose inbound request information

    Can e.g. be used to count the arrival rate of new records to be stored in the record store.

  • protocols/kad: Expose kbucket range on RoutingUpdated

    Can e.g. be used to construct a graph of the current kbucket routing table state.

@mxinden
Copy link
Member Author

mxinden commented Jun 25, 2021

In combination with #2063 this can be used to generate the following Grafana graphs.

image

More to come.

@mxinden mxinden marked this pull request as ready for review June 25, 2021 14:35
@mxinden
Copy link
Member Author

mxinden commented Jun 25, 2021

Marked as ready for review. Anyone out there got some time for a review? Maybe @thomaseizinger?

Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

Can't speak much on the functionality change but got two suggestions for improved naming. Hope it helps :)

// Note on the difference between 'request' and 'query': A request is a
// single request-response style exchange with a single remote peer. A query
// is made of multiple requests across multiple remote peers.
InboundRequest {
Copy link
Contributor

Choose a reason for hiding this comment

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

The name of this variant is not very "eventy" because it doesn't contain a verb and hence doesn't really express, what happened.

What about InboundRequestServed? That would also include the information you've packed into the docs.

},

/// An outbound query has produced a result.
OutboundQueryResult {
Copy link
Contributor

Choose a reason for hiding this comment

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

This one could be named OutboundQueryCompleted or OutboundQueryFinished in the same spirit.

@mxinden
Copy link
Member Author

mxinden commented Jun 28, 2021

but got two suggestions for improved naming

Changed.

Thanks for the input!

@mxinden mxinden merged commit 904880f into libp2p:master Jun 28, 2021
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.

None yet

2 participants