mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
f23c00d870
remove unnescessary import aliases, brackets, and so on. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
27 lines
485 B
Go
27 lines
485 B
Go
package main
|
|
|
|
import (
|
|
"net"
|
|
"net/http"
|
|
|
|
"github.com/docker/go-metrics"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func startMetricsServer(addr string) error {
|
|
if err := allocateDaemonPort(addr); err != nil {
|
|
return err
|
|
}
|
|
l, err := net.Listen("tcp", addr)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
mux := http.NewServeMux()
|
|
mux.Handle("/metrics", metrics.Handler())
|
|
go func() {
|
|
if err := http.Serve(l, mux); err != nil {
|
|
logrus.Errorf("serve metrics api: %s", err)
|
|
}
|
|
}()
|
|
return nil
|
|
}
|