Merge pull request #5256 from kkorekk/fix-prometheus-metrics-for-custom-error-page

Register metrics for custom-error-pages
This commit is contained in:
Kubernetes Prow Robot 2020-07-24 08:22:22 -07:00 committed by GitHub
commit 82997a9711
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,6 +27,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
) )
@ -63,6 +64,11 @@ const (
ErrFilesPathVar = "ERROR_FILES_PATH" ErrFilesPathVar = "ERROR_FILES_PATH"
) )
func init() {
prometheus.MustRegister(requestCount)
prometheus.MustRegister(requestDuration)
}
func main() { func main() {
errFilesPath := "/www" errFilesPath := "/www"
if os.Getenv(ErrFilesPathVar) != "" { if os.Getenv(ErrFilesPathVar) != "" {