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

MetricsTracer Interface: Private “state” Field in UpdatedBlackHoleFilterState Method #2890

Closed
cpeliciari opened this issue Jul 30, 2024 · 3 comments

Comments

@cpeliciari
Copy link
Contributor

Hi,

I am working on monitoring a private system that uses libp2p. Recently, I encountered an issue with the MetricsTracer interface located in p2p/net/swarm/swarm_metrics.go.

The MetricsTracer interface has a method UpdatedBlackHoleFilterState that includes a state field. However, this field is private, which prevents the recreation of the MetricsTracer to collect connection and dial data.

type MetricsTracer interface {
	OpenedConnection(network.Direction, crypto.PubKey, network.ConnectionState, ma.Multiaddr)
	ClosedConnection(network.Direction, time.Duration, network.ConnectionState, ma.Multiaddr)
	CompletedHandshake(time.Duration, network.ConnectionState, ma.Multiaddr)
	FailedDialing(ma.Multiaddr, error, error)
	DialCompleted(success bool, totalDials int)
	DialRankingDelay(d time.Duration)
	UpdatedBlackHoleFilterState(name string, state blackHoleState, nextProbeAfter int, successFraction float64)
}

I would like to know if there is a specific reason for the state field to be private.

Thank you in advance for your attention to this matter.

@sukunrt
Copy link
Member

sukunrt commented Aug 7, 2024

I think we just missed this. Can you open a PR with a method for getting State?

cpeliciari added a commit to cpeliciari/go-libp2p that referenced this issue Aug 11, 2024
This commit changes the `blackHoleState` type from private to public by renaming it to `BlackHoleState`. This modification allows other packages to access and use this type, which is essential for monitoring and debugging purposes within the libp2p system.

Related issue: libp2p#2890
@cpeliciari
Copy link
Contributor Author

I think we just missed this. Can you open a PR with a method for getting State?

@sukunrt,

I just made the state public. Now it is possible to replicate the metrics.

MarcoPolo pushed a commit that referenced this issue Aug 19, 2024
This commit changes the `blackHoleState` type from private to public by renaming it to `BlackHoleState`. This modification allows other packages to access and use this type, which is essential for monitoring and debugging purposes within the libp2p system.

Related issue: #2890
@sukunrt
Copy link
Member

sukunrt commented Aug 20, 2024

Closed by #2917

@sukunrt sukunrt closed this as completed Aug 20, 2024
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

No branches or pull requests

2 participants