Skip to content

Commit 05a48b4

Browse files
committed
add tailnet debug page
1 parent 9320906 commit 05a48b4

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

support/support.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type Bundle struct {
2626
NetcheckLocal *codersdk.WorkspaceAgentConnectionInfo `json:"netcheck_local"`
2727
NetcheckRemote *codersdk.WorkspaceAgentConnectionInfo `json:"netcheck_remote"`
2828
CoordinatorDebug string `json:"coordinator_debug"`
29+
TailnetDebug string `json:"tailnet_debug"`
2930
Logs []string `json:"logs"`
3031
}
3132

@@ -129,11 +130,25 @@ func Run(ctx context.Context, d *Deps) (*Bundle, error) {
129130
d.Log.Error(ctx, "fetch coordinator debug page", slog.Error(err))
130131
} else {
131132
defer coordResp.Body.Close()
132-
coordBytes, err := io.ReadAll(coordResp.Body)
133+
bs, err := io.ReadAll(coordResp.Body)
133134
if err != nil {
134135
d.Log.Error(ctx, "read coordinator debug page", slog.Error(err))
135136
} else {
136-
b.CoordinatorDebug = string(coordBytes)
137+
b.CoordinatorDebug = string(bs)
138+
}
139+
}
140+
141+
// Get /api/v2/debug/tailnet
142+
tailResp, err := d.Client.Request(ctx, http.MethodGet, "/api/v2/debug/tailnet", nil)
143+
if err != nil {
144+
d.Log.Error(ctx, "fetch tailnet debug page", slog.Error(err))
145+
} else {
146+
defer tailResp.Body.Close()
147+
bs, err := io.ReadAll(tailResp.Body)
148+
if err != nil {
149+
d.Log.Error(ctx, "read tailnet debug page", slog.Error(err))
150+
} else {
151+
b.TailnetDebug = string(bs)
137152
}
138153
}
139154

support/support_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func TestRun(t *testing.T) {
4848
require.NotEmpty(t, bun.DeploymentInfo.HealthReport)
4949
require.NotEmpty(t, bun.DeploymentInfo.Experiments)
5050
require.NotEmpty(t, bun.CoordinatorDebug)
51+
require.NotEmpty(t, bun.TailnetDebug)
5152
require.NotNil(t, bun.WorkspaceInfo.Workspace)
5253
require.NotEmpty(t, bun.WorkspaceInfo.BuildLogs)
5354
require.NotNil(t, bun.WorkspaceInfo.Agent)
@@ -78,6 +79,7 @@ func TestRun(t *testing.T) {
7879
require.NotEmpty(t, bun.DeploymentInfo.HealthReport)
7980
require.NotEmpty(t, bun.DeploymentInfo.Experiments)
8081
require.NotEmpty(t, bun.CoordinatorDebug)
82+
require.NotEmpty(t, bun.TailnetDebug)
8183
require.Nil(t, bun.WorkspaceInfo)
8284
require.NotEmpty(t, bun.Logs)
8385
})

0 commit comments

Comments
 (0)