Simplify handler registration and update promhttp
This commit is contained in:
parent
1cdd64384a
commit
d5cf22c129
3 changed files with 137 additions and 90 deletions
136
Gopkg.lock
generated
136
Gopkg.lock
generated
|
@ -4,8 +4,8 @@
|
|||
[[projects]]
|
||||
name = "cloud.google.com/go"
|
||||
packages = ["compute/metadata"]
|
||||
revision = "0fd7230b2a7505833d5f69b75cbd6c9582401479"
|
||||
version = "v0.23.0"
|
||||
revision = "aad3f485ee528456e0768f20397b4d9dd941e755"
|
||||
version = "v0.25.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/Azure/go-autorest"
|
||||
|
@ -15,7 +15,8 @@
|
|||
"autorest/azure",
|
||||
"autorest/date"
|
||||
]
|
||||
revision = "d4e6b95c12a08b4de2d48b45d5b4d594e5d32fab"
|
||||
revision = "1f7cd6cfe0adea687ad44a512dfe76140f804318"
|
||||
version = "v10.12.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -80,7 +81,7 @@
|
|||
branch = "master"
|
||||
name = "github.com/fullsailor/pkcs7"
|
||||
packages = ["."]
|
||||
revision = "ae226422660e5ca10db350d33f81c6608f3fbcdd"
|
||||
revision = "8306686428a5fe132eac8cb7c4848af725098bd4"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/ghodss/yaml"
|
||||
|
@ -123,6 +124,12 @@
|
|||
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/google/btree"
|
||||
packages = ["."]
|
||||
revision = "e89373fe6b4a7413d7acd6da1725b83ef713e6e4"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/google/gofuzz"
|
||||
|
@ -151,7 +158,16 @@
|
|||
"openstack/utils",
|
||||
"pagination"
|
||||
]
|
||||
revision = "282f25e4025de0a42015d2e2b5faef1d920aad3c"
|
||||
revision = "45c2d035713fa44f366921035a44610ac5d45beb"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/gregjones/httpcache"
|
||||
packages = [
|
||||
".",
|
||||
"diskcache"
|
||||
]
|
||||
revision = "9cad4c3443a7200dd6400aef47183728de563a38"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -162,12 +178,6 @@
|
|||
]
|
||||
revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/howeyc/gopass"
|
||||
packages = ["."]
|
||||
revision = "bf9dde6d0d2c004a008c27aaee91170c786f6db8"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/imdario/mergo"
|
||||
packages = ["."]
|
||||
|
@ -177,14 +187,8 @@
|
|||
[[projects]]
|
||||
name = "github.com/json-iterator/go"
|
||||
packages = ["."]
|
||||
revision = "ca39e5af3ece67bbcda3d0f4f56a8e24d9f2dad4"
|
||||
version = "1.1.3"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/kr/pty"
|
||||
packages = ["."]
|
||||
revision = "282ce0e5322c82529687d609ee670fac7c7d917c"
|
||||
version = "v1.1.1"
|
||||
revision = "ab8a2e0c74be9d3be70b3184d9acc634935ded82"
|
||||
version = "1.1.4"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -198,8 +202,8 @@
|
|||
[[projects]]
|
||||
name = "github.com/matttproud/golang_protobuf_extensions"
|
||||
packages = ["pbutil"]
|
||||
revision = "3247c84500bff8d9fb6d579d800f20b3e091582c"
|
||||
version = "v1.0.0"
|
||||
revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c"
|
||||
version = "v1.0.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -228,8 +232,8 @@
|
|||
[[projects]]
|
||||
name = "github.com/modern-go/reflect2"
|
||||
packages = ["."]
|
||||
revision = "1df9eeb2bb81f327b96228865c5687bc2194af3f"
|
||||
version = "1.0.0"
|
||||
revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
|
||||
version = "1.0.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -315,6 +319,18 @@
|
|||
revision = "e790cca94e6cc75c7064b1332e63811d4aae1a53"
|
||||
version = "v1.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/petar/GoLLRB"
|
||||
packages = ["llrb"]
|
||||
revision = "53be0d36a84c2a886ca057d34b6aa4468df9ccb4"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/peterbourgon/diskv"
|
||||
packages = ["."]
|
||||
revision = "5f041e8faa004a95c88a202771f4cc3e991971e6"
|
||||
version = "v2.0.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pkg/errors"
|
||||
packages = ["."]
|
||||
|
@ -322,19 +338,19 @@
|
|||
version = "v0.8.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/prometheus/client_golang"
|
||||
packages = [
|
||||
"prometheus",
|
||||
"prometheus/promhttp"
|
||||
]
|
||||
revision = "c5b7fccd204277076155f10851dad72b76a49317"
|
||||
version = "v0.8.0"
|
||||
revision = "ee1c9d7e23df7f011bdf6f12a5c9e7f0ae10a1fe"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/prometheus/client_model"
|
||||
packages = ["go"]
|
||||
revision = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c"
|
||||
revision = "5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -355,7 +371,7 @@
|
|||
"nfs",
|
||||
"xfs"
|
||||
]
|
||||
revision = "8b1c2da0d56deffdbb9e48d4414b4e674bd8083e"
|
||||
revision = "ae68e2d4c00fed4943b5f6698d504a5fe083da8a"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/spf13/afero"
|
||||
|
@ -363,8 +379,8 @@
|
|||
".",
|
||||
"mem"
|
||||
]
|
||||
revision = "63644898a8da0bc22138abf860edaf5277b6102e"
|
||||
version = "v1.1.0"
|
||||
revision = "787d034dfe70e44075ccc060d346146ef53270ad"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/spf13/pflag"
|
||||
|
@ -375,8 +391,8 @@
|
|||
[[projects]]
|
||||
name = "github.com/zakjan/cert-chain-resolver"
|
||||
packages = ["certUtil"]
|
||||
revision = "c222fb53d84f5c835aab8027b5d422d4089f9d29"
|
||||
version = "1.0.1"
|
||||
revision = "6076e1ded27284d6df12668dba6bee76fc17f84e"
|
||||
version = "1.0.2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -386,7 +402,7 @@
|
|||
"ed25519/internal/edwards25519",
|
||||
"ssh/terminal"
|
||||
]
|
||||
revision = "a3beeb748656e13e54256fd2cde19e058f41f60f"
|
||||
revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -405,7 +421,7 @@
|
|||
"publicsuffix",
|
||||
"trace"
|
||||
]
|
||||
revision = "dfa909b99c79129e1100513e5cd36307665e5723"
|
||||
revision = "cffdcf672aee934982473246bc7e9a8ba446aa9b"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -417,7 +433,7 @@
|
|||
"jws",
|
||||
"jwt"
|
||||
]
|
||||
revision = "770e5ebd4ab27c4d70b0983674d138217f5e2c72"
|
||||
revision = "ef147856a6ddbb60760db74283d2424e98c87bff"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -426,7 +442,7 @@
|
|||
"unix",
|
||||
"windows"
|
||||
]
|
||||
revision = "c11f84a56e43e20a78cee75a7c034031ecf57d1f"
|
||||
revision = "1b2967e3c290b7c545b3db0deeda16e9be4f98a2"
|
||||
|
||||
[[projects]]
|
||||
name = "golang.org/x/text"
|
||||
|
@ -481,14 +497,14 @@
|
|||
"internal/urlfetch",
|
||||
"urlfetch"
|
||||
]
|
||||
revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a"
|
||||
version = "v1.0.0"
|
||||
revision = "b1f26356af11148e710935ed1ac8a7f5702c7612"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = ["googleapis/rpc/status"]
|
||||
revision = "694d95ba50e67b2e363f3483057db5d4910c18f9"
|
||||
revision = "e92b116572682a5b432ddd840aeaba2a559eeff1"
|
||||
|
||||
[[projects]]
|
||||
name = "google.golang.org/grpc"
|
||||
|
@ -497,15 +513,16 @@
|
|||
"balancer",
|
||||
"balancer/base",
|
||||
"balancer/roundrobin",
|
||||
"channelz",
|
||||
"codes",
|
||||
"connectivity",
|
||||
"credentials",
|
||||
"encoding",
|
||||
"encoding/proto",
|
||||
"grpclb/grpc_lb_v1/messages",
|
||||
"grpclog",
|
||||
"internal",
|
||||
"internal/backoff",
|
||||
"internal/channelz",
|
||||
"internal/grpcrand",
|
||||
"keepalive",
|
||||
"metadata",
|
||||
"naming",
|
||||
|
@ -518,8 +535,8 @@
|
|||
"tap",
|
||||
"transport"
|
||||
]
|
||||
revision = "41344da2231b913fa3d983840a57a6b1b7b631a1"
|
||||
version = "v1.12.0"
|
||||
revision = "168a6198bcb0ef175f7dacec0b8691fc141dc9b8"
|
||||
version = "v1.13.0"
|
||||
|
||||
[[projects]]
|
||||
name = "gopkg.in/fsnotify/fsnotify.v1"
|
||||
|
@ -583,12 +600,13 @@
|
|||
"rbac/v1alpha1",
|
||||
"rbac/v1beta1",
|
||||
"scheduling/v1alpha1",
|
||||
"scheduling/v1beta1",
|
||||
"settings/v1alpha1",
|
||||
"storage/v1",
|
||||
"storage/v1alpha1",
|
||||
"storage/v1beta1"
|
||||
]
|
||||
revision = "kubernetes-1.10.3"
|
||||
revision = "kubernetes-1.11.0"
|
||||
|
||||
[[projects]]
|
||||
name = "k8s.io/apiextensions-apiserver"
|
||||
|
@ -600,7 +618,7 @@
|
|||
"pkg/client/clientset/clientset/typed/apiextensions/v1beta1",
|
||||
"pkg/features"
|
||||
]
|
||||
revision = "kubernetes-1.10.3"
|
||||
revision = "kubernetes-1.11.0"
|
||||
|
||||
[[projects]]
|
||||
name = "k8s.io/apimachinery"
|
||||
|
@ -610,9 +628,6 @@
|
|||
"pkg/api/meta",
|
||||
"pkg/api/resource",
|
||||
"pkg/api/validation",
|
||||
"pkg/apimachinery",
|
||||
"pkg/apimachinery/announced",
|
||||
"pkg/apimachinery/registered",
|
||||
"pkg/apis/meta/internalversion",
|
||||
"pkg/apis/meta/v1",
|
||||
"pkg/apis/meta/v1/unstructured",
|
||||
|
@ -658,7 +673,7 @@
|
|||
"third_party/forked/golang/netutil",
|
||||
"third_party/forked/golang/reflect"
|
||||
]
|
||||
revision = "kubernetes-1.10.3"
|
||||
revision = "kubernetes-1.11.0"
|
||||
|
||||
[[projects]]
|
||||
name = "k8s.io/apiserver"
|
||||
|
@ -671,7 +686,7 @@
|
|||
"pkg/util/feature",
|
||||
"pkg/util/logs"
|
||||
]
|
||||
revision = "kubernetes-1.10.3"
|
||||
revision = "kubernetes-1.11.0"
|
||||
|
||||
[[projects]]
|
||||
name = "k8s.io/client-go"
|
||||
|
@ -712,6 +727,7 @@
|
|||
"informers/rbac/v1beta1",
|
||||
"informers/scheduling",
|
||||
"informers/scheduling/v1alpha1",
|
||||
"informers/scheduling/v1beta1",
|
||||
"informers/settings",
|
||||
"informers/settings/v1alpha1",
|
||||
"informers/storage",
|
||||
|
@ -769,6 +785,8 @@
|
|||
"kubernetes/typed/rbac/v1beta1/fake",
|
||||
"kubernetes/typed/scheduling/v1alpha1",
|
||||
"kubernetes/typed/scheduling/v1alpha1/fake",
|
||||
"kubernetes/typed/scheduling/v1beta1",
|
||||
"kubernetes/typed/scheduling/v1beta1/fake",
|
||||
"kubernetes/typed/settings/v1alpha1",
|
||||
"kubernetes/typed/settings/v1alpha1/fake",
|
||||
"kubernetes/typed/storage/v1",
|
||||
|
@ -797,12 +815,14 @@
|
|||
"listers/rbac/v1alpha1",
|
||||
"listers/rbac/v1beta1",
|
||||
"listers/scheduling/v1alpha1",
|
||||
"listers/scheduling/v1beta1",
|
||||
"listers/settings/v1alpha1",
|
||||
"listers/storage/v1",
|
||||
"listers/storage/v1alpha1",
|
||||
"listers/storage/v1beta1",
|
||||
"pkg/apis/clientauthentication",
|
||||
"pkg/apis/clientauthentication/v1alpha1",
|
||||
"pkg/apis/clientauthentication/v1beta1",
|
||||
"pkg/version",
|
||||
"plugin/pkg/client/auth",
|
||||
"plugin/pkg/client/auth/azure",
|
||||
|
@ -832,6 +852,7 @@
|
|||
"util/buffer",
|
||||
"util/cert",
|
||||
"util/cert/triple",
|
||||
"util/connrotation",
|
||||
"util/exec",
|
||||
"util/flowcontrol",
|
||||
"util/homedir",
|
||||
|
@ -840,13 +861,13 @@
|
|||
"util/retry",
|
||||
"util/workqueue"
|
||||
]
|
||||
revision = "kubernetes-1.10.3"
|
||||
revision = "kubernetes-1.11.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "k8s.io/kube-openapi"
|
||||
packages = ["pkg/util/proto"]
|
||||
revision = "41e43949ca69d04b66104069ed3ffd619b289b3d"
|
||||
revision = "0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803"
|
||||
|
||||
[[projects]]
|
||||
name = "k8s.io/kubernetes"
|
||||
|
@ -864,6 +885,8 @@
|
|||
"pkg/apis/core/validation",
|
||||
"pkg/apis/extensions",
|
||||
"pkg/apis/networking",
|
||||
"pkg/apis/policy",
|
||||
"pkg/apis/scheduling",
|
||||
"pkg/capabilities",
|
||||
"pkg/cloudprovider",
|
||||
"pkg/controller",
|
||||
|
@ -873,10 +896,13 @@
|
|||
"pkg/kubelet/container",
|
||||
"pkg/kubelet/types",
|
||||
"pkg/kubelet/util/format",
|
||||
"pkg/kubelet/util/ioutils",
|
||||
"pkg/kubelet/util/sliceutils",
|
||||
"pkg/master/ports",
|
||||
"pkg/scheduler/algorithm",
|
||||
"pkg/scheduler/algorithm/priorities/util",
|
||||
"pkg/scheduler/api",
|
||||
"pkg/scheduler/cache",
|
||||
"pkg/scheduler/util",
|
||||
"pkg/security/apparmor",
|
||||
"pkg/serviceaccount",
|
||||
"pkg/util/file",
|
||||
|
@ -895,17 +921,17 @@
|
|||
"pkg/volume/util/recyclerclient",
|
||||
"third_party/forked/golang/expansion"
|
||||
]
|
||||
revision = "v1.10.3"
|
||||
revision = "v1.11.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "k8s.io/utils"
|
||||
packages = ["exec"]
|
||||
revision = "258e2a2fa64568210fbd6267cf1d8fd87c3cb86e"
|
||||
revision = "ab9069044f32ba0c6da081bb46bb0b12e3862c21"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "56ef61f651cca98e6dc7f7d25fd8dec603be3439bf91ba2e19838c5be1cbeea4"
|
||||
inputs-digest = "a9315cc322f719f566fce26b3f0de8594ab9d4a074febfc1f0de3c99371c37c4"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
14
Gopkg.toml
14
Gopkg.toml
|
@ -78,7 +78,7 @@
|
|||
|
||||
[[constraint]]
|
||||
name = "github.com/prometheus/client_golang"
|
||||
version = "0.8.0"
|
||||
branch = "master"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/spf13/pflag"
|
||||
|
@ -98,24 +98,24 @@
|
|||
|
||||
[[constraint]]
|
||||
name = "k8s.io/kubernetes"
|
||||
revision = "v1.10.3"
|
||||
revision = "v1.11.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "k8s.io/api"
|
||||
revision = "kubernetes-1.10.3"
|
||||
revision = "kubernetes-1.11.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "k8s.io/apimachinery"
|
||||
revision = "kubernetes-1.10.3"
|
||||
revision = "kubernetes-1.11.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "k8s.io/client-go"
|
||||
revision = "kubernetes-1.10.3"
|
||||
revision = "kubernetes-1.11.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "k8s.io/apiextensions-apiserver"
|
||||
revision = "kubernetes-1.10.3"
|
||||
revision = "kubernetes-1.11.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "k8s.io/apiserver"
|
||||
revision = "kubernetes-1.10.3"
|
||||
revision = "kubernetes-1.11.0"
|
||||
|
|
|
@ -119,6 +119,10 @@ func main() {
|
|||
conf.Client = kubeClient
|
||||
|
||||
reg := prometheus.NewRegistry()
|
||||
|
||||
reg.MustRegister(prometheus.NewGoCollector())
|
||||
reg.MustRegister(prometheus.NewProcessCollector(os.Getpid(), ""))
|
||||
|
||||
mc, err := metric.NewCollector(conf.ListenPorts.Status, reg)
|
||||
if err != nil {
|
||||
glog.Fatalf("Error creating prometheus collectos: %v", err)
|
||||
|
@ -131,7 +135,16 @@ func main() {
|
|||
})
|
||||
|
||||
mux := http.NewServeMux()
|
||||
go registerHandlers(conf.EnableProfiling, conf.ListenPorts.Health, ngx, mux, reg)
|
||||
|
||||
if conf.EnableProfiling {
|
||||
registerProfiler(mux)
|
||||
}
|
||||
|
||||
registerHealthz(ngx, mux)
|
||||
registerMetrics(reg, mux)
|
||||
registerHandlers(mux)
|
||||
|
||||
go startHTTPServer(conf.ListenPorts.Health, mux)
|
||||
|
||||
ngx.Start()
|
||||
}
|
||||
|
@ -235,21 +248,7 @@ func handleFatalInitError(err error) {
|
|||
err)
|
||||
}
|
||||
|
||||
func registerHandlers(
|
||||
enableProfiling bool,
|
||||
port int,
|
||||
ic *controller.NGINXController,
|
||||
mux *http.ServeMux,
|
||||
reg *prometheus.Registry) {
|
||||
|
||||
// expose health check endpoint (/healthz)
|
||||
healthz.InstallHandler(mux,
|
||||
healthz.PingHealthz,
|
||||
ic,
|
||||
)
|
||||
|
||||
mux.Handle("/metrics", promhttp.HandlerFor(reg, promhttp.HandlerOpts{}))
|
||||
|
||||
func registerHandlers(mux *http.ServeMux) {
|
||||
mux.HandleFunc("/build", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
b, _ := json.Marshal(version.String())
|
||||
|
@ -262,20 +261,42 @@ func registerHandlers(
|
|||
glog.Errorf("Unexpected error: %v", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if enableProfiling {
|
||||
mux.HandleFunc("/debug/pprof/", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/heap", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/mutex", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/goroutine", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/threadcreate", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/block", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
|
||||
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
||||
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
|
||||
}
|
||||
func registerHealthz(ic *controller.NGINXController, mux *http.ServeMux) {
|
||||
// expose health check endpoint (/healthz)
|
||||
healthz.InstallHandler(mux,
|
||||
healthz.PingHealthz,
|
||||
ic,
|
||||
)
|
||||
}
|
||||
|
||||
func registerMetrics(reg *prometheus.Registry, mux *http.ServeMux) {
|
||||
|
||||
mux.Handle(
|
||||
"/metrics",
|
||||
promhttp.InstrumentMetricHandler(
|
||||
reg,
|
||||
promhttp.HandlerFor(reg, promhttp.HandlerOpts{}),
|
||||
),
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
func registerProfiler(mux *http.ServeMux) {
|
||||
mux.HandleFunc("/debug/pprof/", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/heap", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/mutex", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/goroutine", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/threadcreate", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/block", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
|
||||
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
||||
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
|
||||
}
|
||||
|
||||
func startHTTPServer(port int, mux *http.ServeMux) {
|
||||
server := &http.Server{
|
||||
Addr: fmt.Sprintf(":%v", port),
|
||||
Handler: mux,
|
||||
|
|
Loading…
Reference in a new issue