Fix /metrics double-gzip + deploy script for amd64 build
The Echo gzip middleware was wrapping promhttp's pre-gzipped output, so vmagent received double-compressed bytes that failed the Prometheus parser with binary garbage. Skipping /metrics in the gzip Skipper. Three deploy-script fixes uncovered while shipping this: - _config.sh had backticks around \"kubectl get cm\" inside the python heredoc, which bash treated as command substitution when KUBECONFIG was set. Quoted the literal instead. - 03-deploy.sh now passes --platform linux/amd64 to all docker builds so arm64 Macs don't push images that fail with \"exec format error\" on the Hetzner CX nodes. - OBS_INGEST_TOKEN lookup was reading deploy-k3s/prod.env instead of the actual deploy/prod.env at the repo root. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -107,11 +107,14 @@ func SetupRouter(deps *Dependencies) *echo.Echo {
|
||||
e.Use(corsMiddleware(cfg))
|
||||
e.Use(i18n.Middleware())
|
||||
|
||||
// Gzip compression (skip media endpoints since they serve binary files)
|
||||
// Gzip compression (skip media endpoints since they serve binary files;
|
||||
// also skip /metrics because promhttp does its own content negotiation,
|
||||
// so wrapping it here produces double-gzipped output that breaks scrapers).
|
||||
e.Use(middleware.GzipWithConfig(middleware.GzipConfig{
|
||||
Level: 5,
|
||||
Skipper: func(c echo.Context) bool {
|
||||
return strings.HasPrefix(c.Request().URL.Path, "/api/media/")
|
||||
path := c.Request().URL.Path
|
||||
return strings.HasPrefix(path, "/api/media/") || path == "/metrics"
|
||||
},
|
||||
}))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user