mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-15 01:04:52 +08:00
adding lots of different stats
This commit is contained in:
@@ -165,12 +165,16 @@ func parseURLPath(path string) (vid, fid, filename, ext string, isVolumeIdOnly b
|
||||
func statsCounterHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]interface{})
|
||||
m["Version"] = util.VERSION
|
||||
m["Statistics"] = serverStats
|
||||
m["Counters"] = serverStats
|
||||
writeJsonQuiet(w, r, m)
|
||||
}
|
||||
|
||||
type MemoryStatistics struct {
|
||||
}
|
||||
|
||||
func statsMemoryHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]interface{})
|
||||
m["Version"] = util.VERSION
|
||||
m["Statistics"] = serverStats
|
||||
m["Memory"] = stats.MemStat()
|
||||
writeJsonQuiet(w, r, m)
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@ func NewVolumeServer(r *http.ServeMux, ip string, port int, publicUrl string, fo
|
||||
r.HandleFunc("/admin/delete_collection", secure(vs.whiteList, vs.deleteCollectionHandler))
|
||||
r.HandleFunc("/stats/counter", secure(vs.whiteList, statsCounterHandler))
|
||||
r.HandleFunc("/stats/memory", secure(vs.whiteList, statsMemoryHandler))
|
||||
r.HandleFunc("/stats/disk", secure(vs.whiteList, vs.statsDiskHandler))
|
||||
r.HandleFunc("/", vs.storeHandler)
|
||||
|
||||
go func() {
|
||||
|
@@ -9,6 +9,7 @@ import (
|
||||
"code.google.com/p/weed-fs/go/util"
|
||||
"mime"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -259,3 +260,16 @@ func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m["size"] = uint32(count)
|
||||
writeJsonQuiet(w, r, m)
|
||||
}
|
||||
|
||||
func (vs *VolumeServer) statsDiskHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]interface{})
|
||||
m["Version"] = util.VERSION
|
||||
ds := make([]*stats.DiskStatus, 0)
|
||||
for _, loc := range vs.store.Locations {
|
||||
if dir, e := filepath.Abs(loc.Directory); e == nil {
|
||||
ds = append(ds, stats.NewDiskStatus(dir))
|
||||
}
|
||||
}
|
||||
m["DiskStatues"] = ds
|
||||
writeJsonQuiet(w, r, m)
|
||||
}
|
||||
|
Reference in New Issue
Block a user