DebugManifest returns the agent's in-memory manifest. Unfortunately this must be returns as a []byte to avoid an import cycle.
(ctx context.Context)
| 446 | // DebugManifest returns the agent's in-memory manifest. Unfortunately this must |
| 447 | // be returns as a []byte to avoid an import cycle. |
| 448 | func (c *agentConn) DebugManifest(ctx context.Context) ([]byte, error) { |
| 449 | ctx, span := tracing.StartSpan(ctx) |
| 450 | defer span.End() |
| 451 | res, err := c.apiRequest(ctx, http.MethodGet, "/debug/manifest", nil) |
| 452 | if err != nil { |
| 453 | return nil, xerrors.Errorf("do request: %w", err) |
| 454 | } |
| 455 | defer res.Body.Close() |
| 456 | if res.StatusCode != http.StatusOK { |
| 457 | return nil, codersdk.ReadBodyAsError(res) |
| 458 | } |
| 459 | bs, err := io.ReadAll(res.Body) |
| 460 | if err != nil { |
| 461 | return nil, xerrors.Errorf("read response body: %w", err) |
| 462 | } |
| 463 | return bs, nil |
| 464 | } |
| 465 | |
| 466 | // DebugLogs returns up to the last 10MB of `/tmp/coder-agent.log` |
| 467 | func (c *agentConn) DebugLogs(ctx context.Context) ([]byte, error) { |
nothing calls this directly
no test coverage detected