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"
|
"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) != "" {
|
||||||
|
|
Loading…
Reference in a new issue