Repository navigation
feat(observability): a compose profile, and the 403 that found - #31
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/metricsand nothing else.What this adds
docker compose --profile observability upbrings up Prometheus and Grafana with fold's dashboard already loaded — following the shape of the existingredisandstdioprofiles.deploy/observability/alerts.yml), only because aPrometheusRuleCRD 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,
/metricsincluded. Prometheus scrapes withHost: 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, andoperations.md: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.hostHeaderand has no equivalent for scraping. I documented it rather than fixing it: the honest fix may be exempting/metricsand/healthfrom 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
promtoolwould dofold_requests_total{method="initialize",outcome="ok"} = 3/api/ds/query, dashboard provisioned at 16 panels / 5 rowsBoth 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 checkandmake helm-checkgreen.🤖 Generated with Claude Code