Docs / Serverless

Logs & metrics

Everything your workers write to stdout and stderr is collected per worker and kept for 7 days. Endpoint metrics show traffic, latency, cold starts and spend.

Writing logs

Print to stdout or use the standard logging module. Start Python with -u (or set PYTHONUNBUFFERED=1) so lines appear immediately. Lines logged while a job runs are tagged with its job ID automatically.

handler.py
import logging
import apipods

log = logging.getLogger("worker")
logging.basicConfig(level=logging.INFO)

def handler(job):
    log.info("generating %d steps", job["input"].get("steps", 4))
    ...

apipods.serverless.start({"handler": handler})

Reading logs

GET/endpoints/{endpointId}/logs
$ apipods logs ep_4n8wq2zt --follow
$ apipods logs ep_4n8wq2zt --worker wrk_8q3m2x9k --since 1h
200 OK
{
  "object": "list",
  "data": [
    {
      "timestamp": "2026-11-18T10:02:14.118Z",
      "workerId": "wrk_8q3m2x9k",
      "jobId": "job_3x9wq2mt",
      "stream": "stdout",
      "message": "INFO:worker:generating 4 steps"
    },
    {
      "timestamp": "2026-11-18T10:02:16.052Z",
      "workerId": "wrk_8q3m2x9k",
      "jobId": "job_3x9wq2mt",
      "stream": "stdout",
      "message": "job completed in 1934 ms"
    }
  ],
  "hasMore": false,
  "nextCursor": null
}

Add follow=true to stream new lines as server-sent events. Filter by workerId, jobId or since.

Metrics

GET/endpoints/{endpointId}/metrics?window=1h

window is 1h, 24h or 7d. The console's Metrics tab plots the same series.

200 OK
{
  "endpointId": "ep_4n8wq2zt",
  "window": "1h",
  "requests": {
    "total": 4218,
    "completed": 4190,
    "failed": 21,
    "cancelled": 3,
    "timedOut": 4
  },
  "delayTime": {
    "p50": 410,
    "p95": 2380
  },
  "executionTime": {
    "p50": 1880,
    "p95": 2710
  },
  "coldStarts": 3,
  "warmstartRestores": 11,
  "workers": {
    "average": 3.4,
    "peak": 5
  },
  "gpuSeconds": 9264
}
MetricWhat to look for
delayTime.p95Rising values mean jobs wait for workers: raise maxWorkers, add GPU pools or lower scalerValue.
executionTime.p95Compare with executionTimeoutInSec to avoid TIMED_OUT jobs.
coldStartsFull cold starts. Should be rare with Warmstart enabled; they happen after deploys and on new pools.
gpuSecondsBilled worker time. Multiply by the pool's per-second price to estimate spend.

Alerts

Subscribe to job.failed, job.timed_out and endpoint.worker_unhealthy with webhook subscriptions to forward problems to Slack, PagerDuty or your own monitoring.