Skip to content

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

Merged
merged 17 commits into from
Jul 10, 2024

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Jul 8, 2024

  • Set ConnectionAge to the time since tailnet.NewConn was called.
  • Set ConnectionSetup to the time between tailnet.NewConn being called, and a connected telemetry event being sent.
  • Set P2PSetup to the time between tailnet.NewConn and when we find out our connection is direct.
  • Send telemetry events whenever the Tailscale network map changes.
  • Send telemetry events whenever the connection type changes (DERP<->P2P).

@ethanndickson ethanndickson marked this pull request as draft July 8, 2024 08:35
server.telemetryStore.setNetInfo(ni)
nodeUp.setNetInfo(ni)
})
server.wireguardEngine.AddNetworkMapCallback(func(nm *netmap.NetworkMap) {
Copy link
Member Author

@ethanndickson ethanndickson Jul 8, 2024

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.

@ethanndickson ethanndickson marked this pull request as ready for review July 9, 2024 05:21

// Watch for changes in the connection type (P2P<->DERP) and send telemetry events.
func (c *Conn) watchConnChange() {
ticker := time.NewTicker(time.Millisecond * 50)
Copy link
Member Author

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
Copy link
Member Author

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.

@ethanndickson ethanndickson merged commit e8db21c into main Jul 10, 2024
28 checks passed
@ethanndickson ethanndickson deleted the ethan/more-telemetry branch July 10, 2024 04:14
@github-actions github-actions bot locked and limited conversation to collaborators Jul 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants