-
Notifications
You must be signed in to change notification settings - Fork 964
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
swarm/: Expose time to establish connection #2745
Comments
I'm planning to pick this one up @mxinden , is that ok, or do you have something else in mind for me? |
Please prioritize any WebRTC and Testground related work. That said, yes, help here is very much appreciated whenever you are blocked on WebRTC and Testground. Let us know in case you need any help @GlenDC. |
Understood. I am going to continue to give all my love and energy in the Protocol Labs context to Testground. Let's do it! |
I'm considering implementing this as a Histogram, but if so I'll need to come up with buckets - basically I'll need to know the resolution we're interested in. Since we're talking about networking, I'm guessing somewhere on the order of magnitude of ms or perhaps 10s of ms? |
We can experiment with this over time. I suggest using exponential_buckets(0.001 /* 1ms*/, 2, 16) |
Thinking out loud: If we had a callback on behaviours for pending connections, this could be tracked in a behaviour with tracking the time inside |
The latest proposal of #3099 would allow this to be implemented as a |
Implementing #2745 , adding a metric to break down time from connection pending to connection established, per protocol stack. ```` $curl -s http://127.0.0.1:42183/metrics | grep nt_duration # HELP libp2p_swarm_connection_establishment_duration Time it took (locally) to finish establishing connections. # TYPE libp2p_swarm_connection_establishment_duration histogram libp2p_swarm_connection_establishment_duration_sum{role="Listener",protocols="/ip4/tcp"} 0.007 libp2p_swarm_connection_establishment_duration_count{role="Listener",protocols="/ip4/tcp"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.001"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.002"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.004"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.008"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.016"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.032"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.064"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.128"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.256"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.512"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="+Inf"} 1 lbl@chomp:~lbl $curl -s http://127.0.0.1:34283/metrics | grep nt_duration # HELP libp2p_swarm_connection_establishment_duration Time it took (locally) to finish establishing connections. # TYPE libp2p_swarm_connection_establishment_duration histogram libp2p_swarm_connection_establishment_duration_sum{role="Dialer",protocols="/ip4/tcp"} 0.009 libp2p_swarm_connection_establishment_duration_count{role="Dialer",protocols="/ip4/tcp"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.001"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.002"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.004"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.008"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.016"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.032"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.064"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.128"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.256"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.512"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="+Inf"} 1 ````
Done in #3134. |
Implementing libp2p#2745 , adding a metric to break down time from connection pending to connection established, per protocol stack. ```` $curl -s http://127.0.0.1:42183/metrics | grep nt_duration # HELP libp2p_swarm_connection_establishment_duration Time it took (locally) to finish establishing connections. # TYPE libp2p_swarm_connection_establishment_duration histogram libp2p_swarm_connection_establishment_duration_sum{role="Listener",protocols="/ip4/tcp"} 0.007 libp2p_swarm_connection_establishment_duration_count{role="Listener",protocols="/ip4/tcp"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.001"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.002"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.004"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.008"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.016"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.032"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.064"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.128"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.256"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="0.512"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Listener",protocols="/ip4/tcp",le="+Inf"} 1 lbl@chomp:~lbl $curl -s http://127.0.0.1:34283/metrics | grep nt_duration # HELP libp2p_swarm_connection_establishment_duration Time it took (locally) to finish establishing connections. # TYPE libp2p_swarm_connection_establishment_duration histogram libp2p_swarm_connection_establishment_duration_sum{role="Dialer",protocols="/ip4/tcp"} 0.009 libp2p_swarm_connection_establishment_duration_count{role="Dialer",protocols="/ip4/tcp"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.001"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.002"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.004"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.008"} 0 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.016"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.032"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.064"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.128"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.256"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="0.512"} 1 libp2p_swarm_connection_establishment_duration_bucket{role="Dialer",protocols="/ip4/tcp",le="+Inf"} 1 ````
Description
Expose the time it takes to establish an inbound or outbound connection.
Motivation
Needed for monitoring purposes, e.g. to be exposed to Prometheus via
libp2p-metrics
. Especially relevant now that we are adding two more transport protocols and thus might want to compare them. #2622 #2289Open questions
Pool
, thus not requiringTransport
to be aware of it.Are you planning to do it yourself in a pull request?
Likely not.
The text was updated successfully, but these errors were encountered: