-
Notifications
You must be signed in to change notification settings - Fork 899
feat: add support package #12289
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
feat: add support package #12289
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
address PR comments
- Loading branch information
commit cd41a8479061fdaf37b2cf4b72b6e85dbbcd7b3f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ type Deps struct { | |
|
||
func DeploymentInfo(ctx context.Context, client *codersdk.Client, log slog.Logger) Deployment { | ||
var d Deployment | ||
|
||
bi, err := client.BuildInfo(ctx) | ||
if err != nil { | ||
log.Error(ctx, "fetch build info", slog.Error(err)) | ||
|
@@ -76,7 +77,7 @@ func DeploymentInfo(ctx context.Context, client *codersdk.Client, log slog.Logge | |
d.Config = dc | ||
} | ||
|
||
hr, err := client.GetDebugHealth(ctx) | ||
hr, err := client.DebugHealth(ctx) | ||
if err != nil { | ||
log.Error(ctx, "fetch health report", slog.Error(err)) | ||
} else { | ||
|
@@ -96,7 +97,6 @@ func DeploymentInfo(ctx context.Context, client *codersdk.Client, log slog.Logge | |
func NetworkInfo(ctx context.Context, client *codersdk.Client, log slog.Logger, agentID uuid.UUID) Network { | ||
var n Network | ||
|
||
// Get /api/v2/debug/coordinator | ||
coordResp, err := client.Request(ctx, http.MethodGet, "/api/v2/debug/coordinator", nil) | ||
if err != nil { | ||
log.Error(ctx, "fetch coordinator debug page", slog.Error(err)) | ||
|
@@ -110,7 +110,6 @@ func NetworkInfo(ctx context.Context, client *codersdk.Client, log slog.Logger, | |
} | ||
} | ||
|
||
// Get /api/v2/debug/tailnet | ||
tailResp, err := client.Request(ctx, http.MethodGet, "/api/v2/debug/tailnet", nil) | ||
if err != nil { | ||
log.Error(ctx, "fetch tailnet debug page", slog.Error(err)) | ||
|
@@ -202,6 +201,14 @@ func Run(ctx context.Context, d *Deps) (*Bundle, error) { | |
}, | ||
} | ||
|
||
// Ensure we capture logs from the client. | ||
var logw strings.Builder | ||
d.Log.AppendSinks(sloghuman.Sink(&logw)) | ||
d.Client.SetLogger(d.Log) | ||
defer func() { | ||
b.Logs = strings.Split(logw.String(), "\n") | ||
}() | ||
|
||
authResp, err := d.Client.AuthCheck(ctx, codersdk.AuthorizationRequest{Checks: authChecks}) | ||
if err != nil { | ||
return &b, xerrors.Errorf("check authorization: %w", err) | ||
|
@@ -212,13 +219,6 @@ func Run(ctx context.Context, d *Deps) (*Bundle, error) { | |
} | ||
} | ||
|
||
// Ensure we capture logs from the client. | ||
var logw strings.Builder | ||
d.Log.AppendSinks(sloghuman.Sink(&logw)) | ||
defer func() { | ||
b.Logs = strings.Split(logw.String(), "\n") | ||
}() | ||
|
||
b.Deployment = DeploymentInfo(ctx, d.Client, d.Log) | ||
b.Workspace = WorkspaceInfo(ctx, d.Client, d.Log, d.WorkspaceID, d.AgentID) | ||
b.Network = NetworkInfo(ctx, d.Client, d.Log, d.AgentID) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fetch concurrently? |
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I see the approach you implemented here. It is appropriate, but maybe we could keep a field for bundling errors within the bundle? It would make debugging easier when coderd returns HTTP 500, and the client error is saved.
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.
I'll see if there's a nice generic solution to this in a follow-up.
Uh oh!
There was an error while loading. Please reload this page.
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.
Absolutely 👍 This is something that can be done in a follow-up.