- Notifications
You must be signed in to change notification settings - Fork928
feat(support): add client magicsock and agent prometheus metrics to support bundle#12604
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
74dab00
1073fc4
f333b2d
9378d67
be4f63f
ac084f5
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -364,6 +364,9 @@ func (c *WorkspaceAgentConn) DebugMagicsock(ctx context.Context) ([]byte, error) | ||
if err != nil { | ||
return nil, xerrors.Errorf("do request: %w", err) | ||
} | ||
if res.StatusCode != http.StatusOK { | ||
return nil, ReadBodyAsError(res) | ||
} | ||
defer res.Body.Close() | ||
bs, err := io.ReadAll(res.Body) | ||
if err != nil { | ||
@@ -382,6 +385,9 @@ func (c *WorkspaceAgentConn) DebugManifest(ctx context.Context) ([]byte, error) | ||
return nil, xerrors.Errorf("do request: %w", err) | ||
} | ||
defer res.Body.Close() | ||
if res.StatusCode != http.StatusOK { | ||
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. Ooh, I thought about this in previous PRs but assumed it was handled by | ||
return nil, ReadBodyAsError(res) | ||
} | ||
bs, err := io.ReadAll(res.Body) | ||
if err != nil { | ||
return nil, xerrors.Errorf("read response body: %w", err) | ||
@@ -398,6 +404,28 @@ func (c *WorkspaceAgentConn) DebugLogs(ctx context.Context) ([]byte, error) { | ||
return nil, xerrors.Errorf("do request: %w", err) | ||
} | ||
defer res.Body.Close() | ||
if res.StatusCode != http.StatusOK { | ||
return nil, ReadBodyAsError(res) | ||
} | ||
bs, err := io.ReadAll(res.Body) | ||
if err != nil { | ||
return nil, xerrors.Errorf("read response body: %w", err) | ||
} | ||
return bs, nil | ||
} | ||
// PrometheusMetrics returns a response from the agent's prometheus metrics endpoint | ||
func (c *WorkspaceAgentConn) PrometheusMetrics(ctx context.Context) ([]byte, error) { | ||
ctx, span := tracing.StartSpan(ctx) | ||
defer span.End() | ||
res, err := c.apiRequest(ctx, http.MethodGet, "/debug/prometheus", nil) | ||
if err != nil { | ||
return nil, xerrors.Errorf("do request: %w", err) | ||
} | ||
defer res.Body.Close() | ||
if res.StatusCode != http.StatusOK { | ||
return nil, ReadBodyAsError(res) | ||
} | ||
bs, err := io.ReadAll(res.Body) | ||
if err != nil { | ||
return nil, xerrors.Errorf("read response body: %w", err) | ||
Uh oh!
There was an error while loading.Please reload this page.