aboutsummaryrefslogtreecommitdiff
path: root/weed/server/volume_server_handlers_write.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-06-14 00:54:56 -0700
committerChris Lu <chris.lu@gmail.com>2019-06-14 00:54:56 -0700
commit5f6c9825f8032ae34c64b3459f9ff2aff0c5efcd (patch)
tree389ec4acad783fbcc65fa1d192a20e38cae68773 /weed/server/volume_server_handlers_write.go
parenta11525fe4eb501f4c98db6aaf40800edabf30d08 (diff)
downloadseaweedfs-5f6c9825f8032ae34c64b3459f9ff2aff0c5efcd.tar.xz
seaweedfs-5f6c9825f8032ae34c64b3459f9ff2aff0c5efcd.zip
volume server: adds basic metrics
Diffstat (limited to 'weed/server/volume_server_handlers_write.go')
-rw-r--r--weed/server/volume_server_handlers_write.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/weed/server/volume_server_handlers_write.go b/weed/server/volume_server_handlers_write.go
index 7c0e08554..b53defd26 100644
--- a/weed/server/volume_server_handlers_write.go
+++ b/weed/server/volume_server_handlers_write.go
@@ -15,6 +15,11 @@ import (
)
func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) {
+
+ volumeServerRequestCounter.WithLabelValues("post").Inc()
+ start := time.Now()
+ defer func() { volumeServerHistogram.WithLabelValues("post").Observe(time.Since(start).Seconds()) }()
+
if e := r.ParseForm(); e != nil {
glog.V(0).Infoln("form parse error:", e)
writeJsonError(w, r, http.StatusBadRequest, e)
@@ -60,6 +65,11 @@ func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) {
}
func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
+
+ volumeServerRequestCounter.WithLabelValues("delete").Inc()
+ start := time.Now()
+ defer func() { volumeServerHistogram.WithLabelValues("delete").Observe(time.Since(start).Seconds()) }()
+
n := new(needle.Needle)
vid, fid, _, _, _ := parseURLPath(r.URL.Path)
volumeId, _ := needle.NewVolumeId(vid)