Skip to content

refactor(portmapper)!: non-global metrics collection #20

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Frando
Copy link
Member

@Frando Frando commented Apr 8, 2025

Description

Needed for n0-computer/iroh#3262

Updates iroh-metrics to 0.33, and makes the metrics collection non-global. Metrics are now collected per portmapper service.

Breaking Changes

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

Copy link

github-actions bot commented Apr 8, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/net-tools/pr/20/docs/net_tools/

Last updated: 2025-04-16T11:01:03Z

@n0bot n0bot bot added this to iroh Apr 8, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Apr 8, 2025
@Frando Frando changed the title refactor: non-global metrics collection refactor(portmapper): non-global metrics collection Apr 16, 2025
@Frando Frando changed the title refactor(portmapper): non-global metrics collection refactor(portmapper)!: non-global metrics collection Apr 16, 2025
@@ -73,16 +75,18 @@ pub(super) struct CurrentMapping<M = super::mapping::Mapping> {
/// Waker to ensure this is polled when needed.
#[debug(skip)]
waker: Option<std::task::Waker>,
metrics: Arc<Metrics>,
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we have to store it in an Arc?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have to. My thinking was that the clones are much smaller then. The metrics structs are usually quite large (200-400bytes, 24bytes for each counter) vs. 8 bytes for an Arc. But the Arc has the cost of a pointer derefence for each metric usage. Not sure what is better tbh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

2 participants