Skip to content

Monitoring

The API exposes Prometheus metrics at /metrics (default port 8080). This includes standard Go runtime metrics plus HTTP request metrics from the Chi router middleware.

scrape_configs:
- job_name: quibble-api
static_configs:
- targets: ['quibble-api.quibble.svc.cluster.local:8080']
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: quibble-api
namespace: quibble
spec:
selector:
matchLabels:
app.kubernetes.io/name: quibble
app.kubernetes.io/component: api
endpoints:
- port: http
path: /metrics
EndpointDescription
GET /healthzLiveness probe — checks Postgres and Redis connectivity
GET /readyzReadiness probe — same checks, used by Kubernetes before routing traffic

Both return 200 {"status":"ok"} when healthy or 503 with a failure reason.

The API uses structured JSON logging via Go’s slog. Set LOG_LEVEL to control verbosity:

LevelUse
debugVerbose — request/response details, WebSocket events
infoDefault — service lifecycle, errors
warnDegraded state (e.g. Redis unreachable in dev)
errorErrors only

Log output goes to stdout and is captured by your container runtime. In Kubernetes, forward to your log aggregator (Loki, Datadog, CloudWatch) via a DaemonSet log collector.

AlertCondition
API downNo healthy pods for > 1 minute
High error rateHTTP 5xx rate > 1% over 5 minutes
Postgres connection failureshealthz returning 503
Redis connection failureshealthz returning 503