Merge pull request #2466 from tifayuki/prometheus_go_metrics

add prometheus metrics
This commit is contained in:
Stephen Day
2018-02-09 15:49:04 -08:00
committed by GitHub
113 changed files with 17182 additions and 8 deletions

View File

@@ -21,6 +21,7 @@ import (
"github.com/docker/distribution/registry/listener"
"github.com/docker/distribution/uuid"
"github.com/docker/distribution/version"
"github.com/docker/go-metrics"
gorhandlers "github.com/gorilla/handlers"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -58,6 +59,15 @@ var ServeCmd = &cobra.Command{
log.Fatalln(err)
}
if config.HTTP.Debug.Prometheus.Enabled {
path := config.HTTP.Debug.Prometheus.Path
if path == "" {
path = "/metrics"
}
log.Info("providing prometheus metrics on ", path)
http.Handle(path, metrics.Handler())
}
if err = registry.ListenAndServe(); err != nil {
log.Fatalln(err)
}