Remove /heap endpoint
It was added 5 years ago by Matt and I'm not sure anyone ever used
it after public release (since we have /debug/pprof/heap as well).
It also lacked error checking and allows people to write to disk over HTTP.
@@ -38,7 +38,6 @@ import (
"google.golang.org/grpc"
- pprof_runtime "runtime/pprof"
template_text "text/template"
"github.com/cockroachdb/cmux"
@@ -255,8 +254,6 @@ func New(logger log.Logger, o *Options) *Handler {
router.Get("/version", readyf(h.version))
router.Get("/service-discovery", readyf(h.serviceDiscovery))
- router.Get("/heap", h.dumpHeap)
-
router.Get("/metrics", promhttp.Handler().ServeHTTP)
router.Get("/federate", readyf(httputil.CompressionHandler{
@@ -877,18 +874,6 @@ func (h *Handler) executeTemplate(w http.ResponseWriter, name string, data inter
io.WriteString(w, result)
}
-func (h *Handler) dumpHeap(w http.ResponseWriter, r *http.Request) {
- target := fmt.Sprintf("/tmp/%d.heap", time.Now().Unix())
- f, err := os.Create(target)
- if err != nil {
- level.Error(h.logger).Log("msg", "Could not dump heap", "err", err)
- }
- fmt.Fprintf(w, "Writing to %s...", target)
- defer f.Close()
- pprof_runtime.WriteHeapProfile(f)
- fmt.Fprintf(w, "Done")
-}
-
// AlertStatus bundles alerting rules and the mapping of alert states to row classes.
type AlertStatus struct {
AlertingRules []*rules.AlertingRule
