mirror of
https://github.com/prometheus/prometheus.git
synced 2025-07-03 11:03:25 +00:00
Update low-level i'faces to reflect wireformats.
This commit fixes a critique of the old storage API design, whereby the input parameters were always as raw bytes and never Protocol Buffer messages that encapsulated the data, meaning every place a read or mutation was conducted needed to manually perform said translations on its own. This is taxing. Change-Id: I4786938d0d207cefb7782bd2bd96a517eead186f
This commit is contained in:
parent
7910f6e863
commit
4a87c002e8
19 changed files with 1047 additions and 251 deletions
16
web/web.go
16
web/web.go
|
@ -21,6 +21,9 @@ import (
|
|||
"net/http"
|
||||
"net/http/pprof"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
pprof_runtime "runtime/pprof"
|
||||
|
||||
"code.google.com/p/gorest"
|
||||
"github.com/golang/glog"
|
||||
|
@ -63,6 +66,7 @@ func (w WebService) ServeForever() error {
|
|||
exp.Handle("/databases", w.DatabasesHandler)
|
||||
exp.Handle("/alerts", w.AlertsHandler)
|
||||
exp.HandleFunc("/graph", graphHandler)
|
||||
exp.HandleFunc("/heap", dumpHeap)
|
||||
|
||||
exp.Handle("/api/", compressionHandler{handler: gorest.Handle()})
|
||||
exp.Handle("/metrics", prometheus.DefaultHandler)
|
||||
|
@ -139,6 +143,18 @@ func executeTemplate(w http.ResponseWriter, name string, data interface{}) {
|
|||
}
|
||||
}
|
||||
|
||||
func dumpHeap(w http.ResponseWriter, r *http.Request) {
|
||||
target := fmt.Sprintf("/tmp/%d.heap", time.Now().Unix())
|
||||
f, err := os.Create(target)
|
||||
if err != nil {
|
||||
glog.Error("Could not dump heap: ", err)
|
||||
}
|
||||
fmt.Fprintf(w, "Writing to %s...", target)
|
||||
defer f.Close()
|
||||
pprof_runtime.WriteHeapProfile(f)
|
||||
fmt.Fprintf(w, "Done")
|
||||
}
|
||||
|
||||
func MustBuildServerUrl() string {
|
||||
_, port, err := net.SplitHostPort(*listenAddress)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue