From 857c0441445da6d6c34ab7772ad01820be2cf618 Mon Sep 17 00:00:00 2001 From: Kornel Maleszka Date: Tue, 17 Mar 2020 10:58:39 +0100 Subject: [PATCH] Register metrics for custom-error-pages Request count and timer weren't visible on /metrics endpoint since they haven't been registered in prometheus DefaultRegister. --- images/custom-error-pages/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/images/custom-error-pages/main.go b/images/custom-error-pages/main.go index 7e3f683b1..8f4e6b267 100644 --- a/images/custom-error-pages/main.go +++ b/images/custom-error-pages/main.go @@ -27,6 +27,7 @@ import ( "strings" "time" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" ) @@ -63,6 +64,11 @@ const ( ErrFilesPathVar = "ERROR_FILES_PATH" ) +func init() { + prometheus.MustRegister(requestCount) + prometheus.MustRegister(requestDuration) +} + func main() { errFilesPath := "/www" if os.Getenv(ErrFilesPathVar) != "" {