Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9320906

Browse files
committed
add coordinator debug
1 parent71484a1 commit9320906

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

‎support/support.go

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package support
33
import (
44
"context"
55
"encoding/json"
6+
"io"
7+
"net/http"
68
"strings"
79

810
"golang.org/x/xerrors"
@@ -19,11 +21,12 @@ import (
1921
// Even though we do attempt to sanitize data, it may still contain
2022
// sensitive information and should thus be treated as secret.
2123
typeBundlestruct {
22-
DeploymentInfoDeploymentInfo`json:"deployment_info"`
23-
WorkspaceInfo*WorkspaceInfo`json:"workspace_info"`
24-
NetcheckLocal*codersdk.WorkspaceAgentConnectionInfo`json:"netcheck_local"`
25-
NetcheckRemote*codersdk.WorkspaceAgentConnectionInfo`json:"netcheck_remote"`
26-
Logs []string`json:"logs"`
24+
DeploymentInfoDeploymentInfo`json:"deployment_info"`
25+
WorkspaceInfo*WorkspaceInfo`json:"workspace_info"`
26+
NetcheckLocal*codersdk.WorkspaceAgentConnectionInfo`json:"netcheck_local"`
27+
NetcheckRemote*codersdk.WorkspaceAgentConnectionInfo`json:"netcheck_remote"`
28+
CoordinatorDebugstring`json:"coordinator_debug"`
29+
Logs []string`json:"logs"`
2730
}
2831

2932
typeDeploymentInfostruct {
@@ -121,6 +124,18 @@ func Run(ctx context.Context, d *Deps) (*Bundle, error) {
121124
}
122125

123126
// Get /api/v2/debug/coordinator
127+
coordResp,err:=d.Client.Request(ctx,http.MethodGet,"/api/v2/debug/coordinator",nil)
128+
iferr!=nil {
129+
d.Log.Error(ctx,"fetch coordinator debug page",slog.Error(err))
130+
}else {
131+
defercoordResp.Body.Close()
132+
coordBytes,err:=io.ReadAll(coordResp.Body)
133+
iferr!=nil {
134+
d.Log.Error(ctx,"read coordinator debug page",slog.Error(err))
135+
}else {
136+
b.CoordinatorDebug=string(coordBytes)
137+
}
138+
}
124139

125140
// Below checks require a workspace and agent
126141
ifd.WorkspaceID==uuid.Nil {

‎support/support_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func TestRun(t *testing.T) {
4747
assertSanitizedDeploymentConfig(t,bun.DeploymentInfo.Config)
4848
require.NotEmpty(t,bun.DeploymentInfo.HealthReport)
4949
require.NotEmpty(t,bun.DeploymentInfo.Experiments)
50+
require.NotEmpty(t,bun.CoordinatorDebug)
5051
require.NotNil(t,bun.WorkspaceInfo.Workspace)
5152
require.NotEmpty(t,bun.WorkspaceInfo.BuildLogs)
5253
require.NotNil(t,bun.WorkspaceInfo.Agent)
@@ -76,6 +77,7 @@ func TestRun(t *testing.T) {
7677
assertSanitizedDeploymentConfig(t,bun.DeploymentInfo.Config)
7778
require.NotEmpty(t,bun.DeploymentInfo.HealthReport)
7879
require.NotEmpty(t,bun.DeploymentInfo.Experiments)
80+
require.NotEmpty(t,bun.CoordinatorDebug)
7981
require.Nil(t,bun.WorkspaceInfo)
8082
require.NotEmpty(t,bun.Logs)
8183
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp