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.
This commit is contained in:
parent
12bbdaaa53
commit
857c044144
1 changed files with 6 additions and 0 deletions
|
@ -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) != "" {
|
||||
|
|
Loading…
Reference in a new issue