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 canonical peer status logs #1624

Merged
merged 4 commits into from
Jul 1, 2022
Merged

Add canonical peer status logs #1624

merged 4 commits into from
Jul 1, 2022

Conversation

MarcoPolo
Copy link
Collaborator

@MarcoPolo MarcoPolo commented Jun 30, 2022

This PR logs 1% of the following events:

  1. A connection is established.
  2. A handshake fails.

This is useful for a couple reasons:

  1. High churn from a misbehaving peer becomes obvious. If a peer churns 100 connections / second. Then it'll log roughly once a second. An operator can either manually ban this peer or hook the logs up to fail2ban so that the system automatically blocks misbehaving peers. See Add canonical peer status logging with sampling go-libp2p-core#269 for an example.
  2. Handshake failures in aggregate also become obvious.
  3. Keep a pulse on the system. e.g. No new connections in hours seem suspicious.
  4. At a glance you can also see the distribution of quic vs the rest of the transports. This would be better as a metric of course, but still interesting.

The tests will fail since this updates go-libp2p-core which breaks go-libp2p-circuit, which would work if we updated go-libp2p-circuit's dependency on go-libp2p.

Not sure how to resolve. One idea is to depend on a branch of go-libp2p-circuit which depends on go-libp2p-master. Any other suggestions?

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

We can escape dependency hell by rebasing after #1626 was merged.

p2p/net/upgrader/upgrader.go Outdated Show resolved Hide resolved
@BigLep BigLep mentioned this pull request Jul 1, 2022
41 tasks
@MarcoPolo MarcoPolo force-pushed the marco/log-peer-status branch 2 times, most recently from 475dde5 to 383d1b0 Compare July 1, 2022 18:12
Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

LGTM, modulo the leftover log in QUIC.

p2p/transport/quic/transport.go Outdated Show resolved Hide resolved
@MarcoPolo MarcoPolo merged commit 452ddfb into master Jul 1, 2022
@MarcoPolo MarcoPolo deleted the marco/log-peer-status branch July 1, 2022 19:52
@ajnavarro ajnavarro mentioned this pull request Aug 24, 2022
72 tasks
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