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(swarm): expose ConnectionId and add conn duration metric #3927

Merged
merged 10 commits into from
May 17, 2023

Conversation

mxinden
Copy link
Member

@mxinden mxinden commented May 15, 2023

Description

  • Exposes the ConnectionId in the various SwarmEvent variants.
  • Tracks connection duration in libp2p-metrics::swarm.

Notes & open questions

Draft as it depends on prometheus/client_rust#137.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

…metric

- Exposes the `ConnectionId` in the various `SwarmEvent` variants.
- Tracks connection duration in `libp2p-metrics::swarm`.
@mxinden mxinden linked an issue May 15, 2023 that may be closed by this pull request
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.

Direction looks good.

misc/metrics/CHANGELOG.md Outdated Show resolved Hide resolved
swarm/CHANGELOG.md Show resolved Hide resolved
swarm/CHANGELOG.md Outdated Show resolved Hide resolved
swarm/CHANGELOG.md Outdated Show resolved Hide resolved
swarm/src/lib.rs Show resolved Hide resolved
mxinden and others added 4 commits May 16, 2023 06:32
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
@mxinden mxinden marked this pull request as ready for review May 16, 2023 05:59
@mergify
Copy link
Contributor

mergify bot commented May 16, 2023

This pull request has merge conflicts. Could you please resolve them @mxinden? 🙏

#[derive(EncodeLabelSet, Hash, Clone, Eq, PartialEq, Debug)]
struct ConnectionClosedLabels {
role: Role,
protocols: String,
// TODO: Should be Option<ConnectionError>. Needs https://github.com/prometheus/client_rust/pull/137
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we wait for this before merging here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oversight. Fixed with 9578315. Thanks for the catch Thomas!

@mxinden mxinden changed the title feat(swarm): expose ConnectionId thus enable connection duration metric feat(swarm): expose ConnectionId and add conn duration metric May 17, 2023
@mergify mergify bot merged commit cc5b346 into libp2p:master May 17, 2023
umgefahren pushed a commit to umgefahren/rust-libp2p that referenced this pull request Mar 8, 2024
- Exposes the `ConnectionId` in the various `SwarmEvent` variants.
- Tracks connection duration in `libp2p-metrics::swarm`.

Pull-Request: libp2p#3927.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(swarm): expose duration of a connection
2 participants