Changeset 0.33.0 (#207)
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit is contained in:
63
CHANGELOG.md
63
CHANGELOG.md
@@ -1,5 +1,68 @@
|
||||
# Changelog
|
||||
|
||||
## [0.33.0] — 2026-03-19
|
||||
|
||||
### Summary
|
||||
|
||||
Observability: structured logging, Prometheus metrics, OpenAPI docs,
|
||||
Grafana dashboards, alerting rules, and a built-in admin monitoring
|
||||
dashboard. Operate the platform without reading Go source code.
|
||||
|
||||
### New
|
||||
|
||||
- **Structured logging (`slog`)** — `LOG_FORMAT=json|text`,
|
||||
`LOG_LEVEL=debug|info|warn|error`. JSON handler for production,
|
||||
text handler for development. Request ID, method, path, status,
|
||||
latency, client IP, and user ID on every request log line.
|
||||
- **Request ID middleware** — `X-Request-Id` UUID header generated per
|
||||
request (or forwarded from upstream). Propagated through completion
|
||||
chain as correlation ID.
|
||||
- **Prometheus `/metrics` endpoint** — `switchboard_http_requests_total`,
|
||||
`switchboard_http_request_duration_seconds`, `switchboard_websocket_connections`,
|
||||
`switchboard_completion_tokens_total`, `switchboard_completions_total`,
|
||||
`switchboard_completion_duration_seconds`, `switchboard_provider_status`,
|
||||
`switchboard_db_open_connections` (+ `_in_use`, `_idle`, `_wait_count`,
|
||||
`_wait_duration`), `switchboard_task_executions_total`,
|
||||
`switchboard_sandbox_executions_total`. Uses `c.FullPath()` for
|
||||
path patterns (no cardinality explosion).
|
||||
- **OpenAPI 3.0.3 spec** — hand-curated `openapi.yaml` covering auth,
|
||||
channels, completions, health, and admin API groups. Served at
|
||||
`/api/docs/openapi.yaml`.
|
||||
- **Swagger UI** — `/api/docs` renders interactive API browser via CDN.
|
||||
System-respecting light/dark mode with WCAG AA 4.5:1+ contrast ratios.
|
||||
- **Grafana dashboard** — `switchboard-overview.json` with request rate,
|
||||
latency percentiles, provider health, token usage, DB pool, Go runtime.
|
||||
- **PrometheusRule alerting** — OOM recovery, provider down, pool
|
||||
exhaustion, high error rate, task failure spike.
|
||||
- **ServiceMonitor** — Helm template for Prometheus Operator discovery
|
||||
(gated: `monitoring.serviceMonitor.enabled`).
|
||||
- **Admin monitoring dashboard** — `GET /api/v1/admin/dashboard`
|
||||
aggregates provider health, 24h usage totals, DB pool stats, WS
|
||||
connections, Go runtime (goroutines, heap, sys, GC count, Go version),
|
||||
storage status, and recent errors. Auto-refreshes every 30s.
|
||||
- **ICD observability tests** — 6 tests covering `/metrics`,
|
||||
`/api/docs`, `/api/docs/openapi.yaml`, `X-Request-Id` generation,
|
||||
`X-Request-Id` passthrough, and admin dashboard.
|
||||
|
||||
### Changed
|
||||
|
||||
- **`middleware/logging.go`** — rewritten from `gin.Logger` wrapper to
|
||||
`slog.Info` with structured fields. `SkipPaths` still honored.
|
||||
- **`config/config.go`** — added `LogFormat`, `LogLevel` fields with
|
||||
`LOG_FORMAT`, `LOG_LEVEL` env var loading.
|
||||
- **`events/ws.go`** — WebSocket connect/disconnect now updates
|
||||
`switchboard_websocket_connections` gauge.
|
||||
- **`health/accumulator.go`** — flush cycle updates
|
||||
`switchboard_provider_status` gauge per provider config.
|
||||
- **`handlers/completion.go`** — instrumented with token counters,
|
||||
completion latency histogram, and status counter.
|
||||
- **Dockerfile** — Go 1.22 → Go 1.23 (required by `prometheus/client_golang`).
|
||||
- **`nginx.conf`** — added `location = /metrics` proxy rule.
|
||||
- **Admin monitoring tab** — landing page changed from Usage to Dashboard.
|
||||
- **Helm `values.yaml`** — added `monitoring` section (serviceMonitor,
|
||||
grafanaDashboard, prometheusRule — all `enabled: false` by default)
|
||||
and `logging.format`, `logging.level`.
|
||||
|
||||
## [0.32.0] — 2026-03-19
|
||||
|
||||
### Summary
|
||||
|
||||
Reference in New Issue
Block a user