DebugLogs returns up to the last 10MB of `/tmp/coder-agent.log`
(ctx context.Context)
| 465 | |
| 466 | // DebugLogs returns up to the last 10MB of `/tmp/coder-agent.log` |
| 467 | func (c *agentConn) DebugLogs(ctx context.Context) ([]byte, error) { |
| 468 | ctx, span := tracing.StartSpan(ctx) |
| 469 | defer span.End() |
| 470 | res, err := c.apiRequest(ctx, http.MethodGet, "/debug/logs", nil) |
| 471 | if err != nil { |
| 472 | return nil, xerrors.Errorf("do request: %w", err) |
| 473 | } |
| 474 | defer res.Body.Close() |
| 475 | if res.StatusCode != http.StatusOK { |
| 476 | return nil, codersdk.ReadBodyAsError(res) |
| 477 | } |
| 478 | bs, err := io.ReadAll(res.Body) |
| 479 | if err != nil { |
| 480 | return nil, xerrors.Errorf("read response body: %w", err) |
| 481 | } |
| 482 | return bs, nil |
| 483 | } |
| 484 | |
| 485 | // PrometheusMetrics returns a response from the agent's prometheus metrics endpoint |
| 486 | func (c *agentConn) PrometheusMetrics(ctx context.Context) ([]byte, error) { |
nothing calls this directly
no test coverage detected