Operations

Health checks and observability endpoints.

Health check

Verify the proxy is running and connected to the upstream database.

terminal
GET /health

# Response (healthy)
{
  "status": "ok",
  "upstream": "connected"
}

# Response (degraded)
{
  "status": "degraded",
  "upstream": "disconnected",
  "error": "connection refused"
}

Prometheus metrics

Prometheus-formatted metrics for monitoring.

terminal
GET /metrics

# Response
# HELP astapa_sessions_active Number of active sessions
# TYPE astapa_sessions_active gauge
astapa_sessions_active 3

# HELP astapa_mutations_total Total mutations staged
# TYPE astapa_mutations_total counter
astapa_mutations_total{status="approved"} 142
astapa_mutations_total{status="rejected"} 8

# HELP astapa_proxy_queries_total Total queries through proxy
# TYPE astapa_proxy_queries_total counter
astapa_proxy_queries_total{type="read"} 15234
astapa_proxy_queries_total{type="write"} 892

Service ports

ServiceDefault portDescription
REST API8080Session management, review endpoints
PostgreSQL Proxy5433Database connection with write staging

Example: monitoring setup

prometheus.yml
# prometheus.yml
scrape_configs:
  - job_name: 'astapa'
    static_configs:
      - targets: ['localhost:8080']
    metrics_path: /metrics
    scrape_interval: 15s