Skip to content

feat(observability): a compose profile, and the 403 that found - #31

Merged
blakebauman merged 1 commit into
mainfrom
feat/compose-observability
Aug 11, 2026
Merged

blakebauman merged 1 commit into
mainfrom
feat/compose-observability

Conversation

@blakebauman

Copy link
Copy Markdown
Member

Follow-up to #30, which shipped the dashboard and alerts Kubernetes-only: the JSON sat inside the chart and the rules existed solely as a PrometheusRule, inert without the prometheus-operator. A compose user could scrape /metrics and nothing else.

What this adds

docker compose --profile observability up brings up Prometheus and Grafana with fold's dashboard already loaded — following the shape of the existing redis and stdio profiles.

  • The dashboard is mounted from the chart's copy, not duplicated: one file, two deployment shapes.
  • The alerts are duplicated (deploy/observability/alerts.yml), only because a PrometheusRule CRD and a plain rules file cannot be the same document — with a test requiring identical alert names so a deployment shape cannot silently lose one.

Running it found a real bug

fold's DNS-rebinding protection wraps the whole mux, /metrics included. Prometheus scrapes with Host: fold:8080, gets 403, and the target reads as down with no other symptom.

Under compose the fix is one config line, now stated in the compose header, prometheus.yml, deploy.md, and operations.md:

"server": { "allowedHosts": ["localhost", "fold"] }

The same constraint very likely defeats the ServiceMonitor from #30. The operator scrapes the pod IP, and no static allowlist can name a dynamic one. The chart already solves this for probes via probes.hostHeader and has no equivalent for scraping. I documented it rather than fixing it: the honest fix may be exempting /metrics and /health from host validation, and that is a security-posture decision, not a patch to slip into an observability change. Flagging for your call.

Verified by running it, not reading it

  • Prometheus scrape target up
  • 8/8 rules loaded — a real Prometheus parsing every expression, which is the check promtool would do
  • 3 requests through fold → fold_requests_total{method="initialize",outcome="ok"} = 3
  • Grafana returned that same value through its own /api/ds/query, dashboard provisioned at 16 panels / 5 rows

Both new tests were mutation-checked: renaming a metric by one character, and deleting one alert from the plain file, each fail with a precise message.

make check and make helm-check green.

🤖 Generated with Claude Code

The packaged dashboard and alerts shipped Kubernetes-only: the JSON sat inside
the chart and the rules existed solely as a PrometheusRule, which is inert
without the prometheus-operator. A compose user could scrape /metrics and
nothing else.

`docker compose --profile observability up` now brings up Prometheus and
Grafana with the dashboard already loaded, following the redis and stdio
profiles' shape. The dashboard is mounted from the chart's copy rather than
duplicated — one file, two deployment shapes — and the alerts are duplicated
only because the two consumers cannot read each other's format, with a test
requiring identical alert names so a deployment shape cannot silently lose one.

Running it found a real bug, which is the point of running it. fold's
DNS-rebinding protection wraps the whole mux, /metrics included, so Prometheus
scraping Host "fold:8080" is answered 403 and the target reads as down with no
other symptom. Under compose the fix is one config line, now stated in the
compose header, prometheus.yml, deploy.md, and operations.md:
  "server": { "allowedHosts": ["localhost", "fold"] }

The same constraint very likely defeats the ServiceMonitor shipped alongside
the chart: the operator scrapes the pod IP, and no static allowlist can name a
dynamic one. The chart already solves this for probes via probes.hostHeader
and has no equivalent for scraping. Documented rather than fixed — the honest
fix may be exempting /metrics and /health from host validation, which is a
security-posture decision, not a patch to slip into an observability change.

Verified by running the stack, not by reading it: scrape target up, all eight
rules loaded (a real Prometheus parsing every expression, which is the check
promtool would do), three requests through fold appearing as
fold_requests_total{method="initialize",outcome="ok"} = 3, and Grafana
returning that same value through its own /api/ds/query with the dashboard
provisioned at 16 panels across 5 rows.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@blakebauman
blakebauman merged commit 7131163 into main Aug 11, 2026
6 checks passed
@blakebauman
blakebauman deleted the feat/compose-observability branch August 11, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant