Observability
Thoth gives you live visibility into Rivergate itself. It works with the tools you already run, and none of them are required.
Signal paths
The API and the worker each provide three ways to observe them.
| Path | Interface | Notes |
|---|---|---|
| Metrics scrape | Prometheus-compatible /metrics | Private listeners. Defaults: API 127.0.0.1:9464, worker 127.0.0.1:9465. Compose keeps both on the internal network and does not publish them. |
| OpenTelemetry | OTLP/HTTP logs, metrics and traces | Optional. Standard OTEL_EXPORTER_OTLP_* variables. |
| Logs | Structured JSON on stdout | Collected by your container log pipeline. Sampled request logs carry trace and span IDs. |
Rivergate does not bundle Prometheus, Grafana, an OpenTelemetry Collector, alert notification, or metric history. It exposes standard interfaces, and you connect the backend you prefer.
What is measured
| Area | Measurements |
|---|---|
| HTTP | Request count, latency and active requests by method, route template and response class — for the API and the worker’s health endpoints. |
| PostgreSQL | Operation counts and durations by SELECT, INSERT, UPDATE, DELETE or other; errors without SQL or arguments; live pool state and acquisition counters. |
| Redis | Command categories and durations, errors without keys or values, pipeline timing, pool state, waits and timeouts. |
| Worker | Per-batch runs, failures, worked batches and duration for audit checkpoints, key rotation, hierarchy rotation, lease expiry and revocation, and replacement-request scheduling. |
| Rotation state | Aggregate counts: running key rotations, pending replacement requests, pending credential revocations, failed leases in the last 24 hours. No tenant or resource IDs. |
| Process | Go runtime and process metrics, uptime, and API request totals since start. |
| Health | Liveness and readiness for the API and worker, and current PostgreSQL and Redis availability. |
Some totals — API request totals, worker job outcomes, pool counters — are process-lifetime values and reset on restart.
Health endpoints
GET /health/live— the process responds.GET /health/ready— PostgreSQL and Redis are reachable. Use this for readiness probes.- The worker exposes an internal health endpoint that reports fixed job counters to the API for the admin view. It carries no secret or tenant identifiers; keep it on the internal network.
Scrape with Prometheus
scrape_configs:
- job_name: rivergate-api
metrics_path: /metrics
static_configs:
- targets: [api:9464]
- job_name: rivergate-worker
metrics_path: /metrics
static_configs:
- targets: [worker:9464]
The targets above match the Compose network. Outside Compose, set METRICS_ADDR and WORKER_METRICS_ADDR to private listener addresses and restrict who can reach them. The endpoints have no authentication.
Ready-made scrape and alert-rule examples are in rivergate-deployment/deployments/observability/ (prometheus.yml and rivergate-alerts.yml). They cover elevated API 5xx rates, PostgreSQL pool pressure, Redis pool timeouts, worker job failures and pending credential revocations. Prometheus evaluates the rules; configure Alertmanager separately for notifications.
To look at the raw metrics in a Compose run:
docker compose exec api wget -qO- http://127.0.0.1:9464/metrics | grep -E 'rivergate_(http_|postgres_|redis_|pool_|rotation_)'
docker compose exec worker wget -qO- http://127.0.0.1:9464/metrics | grep -E 'rivergate_(worker_|pool_|rotation_)'
Export with OpenTelemetry
Point Rivergate at a collector reachable from both the API and the worker. A shared endpoint enables all three signals:
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318 make -C rivergate-deployment up
Or configure signals individually:
| Variable | Purpose |
|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | Shared OTLP/HTTP endpoint for all signals. |
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT · _METRICS_ENDPOINT · _TRACES_ENDPOINT | Per-signal endpoints. |
OTEL_LOGS_EXPORTER · OTEL_METRICS_EXPORTER · OTEL_TRACES_EXPORTER | Select or disable an exporter per signal. |
OTEL_EXPORTER_OTLP_HEADERS | Collector headers, for authenticated endpoints. |
- Use deployment-managed secrets and TLS for authenticated collectors. Keep collector credentials out of shell history, source control and broadly readable configuration.
- Without a collector, Prometheus scraping and stdout logs still work.
- Exporter setup or delivery failures are logged generically and never block requests, jobs or audit-gated secret reads.
Traces
- The API starts root traces at a 10% sample rate and ignores caller-supplied sampling flags and trace context.
- PostgreSQL and Redis operations become child spans within a sampled request. Worker database operations are sampled independently.
- Spans never carry request bodies, bind values, Redis keys, secret paths or credentials.
The admin view
System administrators have a native Observability page in the dashboard (GET /api/v1/system/observability). It shows component health for the API, worker, PostgreSQL and Redis, pool snapshots, aggregate rotation state, a worker job table and whether each exporter is configured. It reports current and process-lifetime values, not history, and it shows exporter configuration, not collector reachability.
Alerts
The admin view raises cards from real current or process-lifetime state:
- API, worker, PostgreSQL or Redis unavailable, or the worker health endpoint not configured.
- API 5xx responses since start.
- PostgreSQL pool at or above 90% of capacity.
- Redis pool wait timeouts.
- Worker job failures since the worker started.
- Pending dynamic credential revocations, and lease failures in the last 24 hours.
These are indicators, not durable incident records. Rivergate does not send notifications or keep alert history; use Alertmanager for delivery.
Telemetry privacy
Telemetry never contains secret values, credentials, private keys, SQL text or arguments, Redis keys or values, request bodies, or tenant and resource identifiers.
- Metric labels use bounded enums: status classes, route templates, dependency names and fixed worker job names. Organization, project, principal, secret, lease and provider IDs are never labels.
- Remote log bodies and attributes use allowlists, and raw error values are excluded.
- Telemetry is a separate path from the audit log.
Bind them to private networks and allow only approved scrapers.
What Thoth does not include
Historical storage, notification delivery, a public metrics API, Operator reconciliation metrics, and secret-specific dimensions are not part of Thoth. Use Prometheus or your OpenTelemetry backend for retention and alerting delivery.