diff --git a/prometheus/registry.go b/prometheus/registry.go index 65ea520..8485f9a 100644 --- a/prometheus/registry.go +++ b/prometheus/registry.go @@ -21,12 +21,14 @@ package prometheus import ( "bytes" + "compress/gzip" "errors" "fmt" "hash/fnv" "io" "net/http" "net/url" + "os" "sort" "strings" "sync" @@ -34,7 +36,6 @@ import ( dto "github.com/prometheus/client_model/go" "code.google.com/p/goprotobuf/proto" - "compress/gzip" "github.com/prometheus/client_golang/_vendor/goautoneg" "github.com/prometheus/client_golang/model" @@ -42,7 +43,7 @@ import ( ) var ( - defRegistry = newRegistry() + defRegistry = newDefaultRegistry() errAlreadyReg = errors.New("duplicate metrics collector registration attempted") ) @@ -643,6 +644,13 @@ func newRegistry() *registry { } } +func newDefaultRegistry() *registry { + r := newRegistry() + r.Register(NewProcessCollector(os.Getpid(), "")) + r.Register(NewGoCollector()) + return r +} + func chooseEncoder(req *http.Request) (encoder, string) { accepts := goautoneg.ParseAccept(req.Header.Get(acceptHeader)) for _, accept := range accepts {