fix: log stack trace while computing metrics (#2865)

This commit is contained in:
mmetc 2024-03-01 10:52:35 +01:00 committed by GitHub
parent 8e9e091656
commit 41b43733b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -102,6 +102,8 @@ var globalPourHistogram = prometheus.NewHistogramVec(
func computeDynamicMetrics(next http.Handler, dbClient *database.Client) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// catch panics here because they are not handled by servePrometheus
defer trace.CatchPanic("crowdsec/computeDynamicMetrics")
//update cache metrics (stash)
cache.UpdateCacheMetrics()
//update cache metrics (regexp)