MCPcopy Index your code
hub / github.com/coder/coder / DebugLogs

Method DebugLogs

codersdk/workspacesdk/agentconn.go:467–483  ·  view source on GitHub ↗

DebugLogs returns up to the last 10MB of `/tmp/coder-agent.log`

(ctx context.Context)

Source from the content-addressed store, hash-verified

465
466// DebugLogs returns up to the last 10MB of `/tmp/coder-agent.log`
467func (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
486func (c *agentConn) PrometheusMetrics(ctx context.Context) ([]byte, error) {

Callers

nothing calls this directly

Calls 6

apiRequestMethod · 0.95
StartSpanFunction · 0.92
ReadBodyAsErrorFunction · 0.92
CloseMethod · 0.65
ErrorfMethod · 0.45
ReadAllMethod · 0.45

Tested by

no test coverage detected