Requests with invalid utf-8 can cause panic in the prometheus metrics.go library
goroutine 24 [running]: github.com/prometheus/client_golang/prometheus.(*GaugeVec).WithLabelValues(...) /go/pkg/mod/github.com/prometheus/client_golang@v1.17.0/prometheus/gauge.go:238 wikimedia-enterprise/api/main/submodules/httputil.(*MetricsRecorder).Serve.func1() /app/submodules/httputil/metrics.go:233 +0x539 created by wikimedia-enterprise/api/main/submodules/httputil.(*MetricsRecorder).Serve in goroutine 45 /app/submodules/httputil/metrics.go:229 +0x26
- Replace gcx.Request.URL.Path with gcx.FullPath() that is not prone to invalid utf-8 issues and will ease the high cardinality problem since the path labels will have
path="/v2/structured-contents/*name"
- Remove the gcx.ClientIP() and usr.GetUsername() from the labels completely as they are the cause of high cardinality.