-
Notifications
You must be signed in to change notification settings - Fork 928
chore: add additional network telemetry stats & events #13800
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
Conversation
server.telemetryStore.setNetInfo(ni) | ||
nodeUp.setNetInfo(ni) | ||
}) | ||
server.wireguardEngine.AddNetworkMapCallback(func(nm *netmap.NetworkMap) { |
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 use this callback to ensure we always have the latest Tailscale node data for a given peer.
|
||
// Watch for changes in the connection type (P2P<->DERP) and send telemetry events. | ||
func (c *Conn) watchConnChange() { | ||
ticker := time.NewTicker(time.Millisecond * 50) |
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.
Because we have to manually check if the connection has changed like this, P2PSetup can be ~50ms off it's true value.
|
||
// nil if not connected | ||
connSetupTime *durationpb.Duration | ||
connectedIP *netip.Addr |
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.
To support coderd and agent telemetry in the future, we'll need to change this to a map of peers to nodes/IPs.
ConnectionAge
to the time sincetailnet.NewConn
was called.ConnectionSetup
to the time betweentailnet.NewConn
being called, and a connected telemetry event being sent.P2PSetup
to the time betweentailnet.NewConn
and when we find out our connection is direct.