-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: main
Are you sure you want to change the base?
Conversation
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 |
@@ -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>, |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
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
portmapper::metrics::Metrics
now implementsMetricsGroup
from[email protected]
, and no longer implementsMetric
from[email protected]
.Notes & open questions
Change checklist