aboutsummaryrefslogtreecommitdiff
path: root/weed/server
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2022-08-01 13:31:01 -0700
committerGitHub <noreply@github.com>2022-08-01 13:31:01 -0700
commitfc8035d6722f5cf79e1596a21c3f8827a632a002 (patch)
tree2f833124d274ced1ec5431b91efef2cf5acb4905 /weed/server
parentbd5c9904be2dcc0a118fb0863a007d3c46aecafd (diff)
parent3ffa4ba91dfdeba985ab6f7933b4d789ab702442 (diff)
downloadseaweedfs-fc8035d6722f5cf79e1596a21c3f8827a632a002.tar.xz
seaweedfs-fc8035d6722f5cf79e1596a21c3f8827a632a002.zip
Merge pull request #3394 from kmlebedev/metricsReplicatedWrite
Detailed metrics VolumeServerRequestHistogram for writing to disk and replication
Diffstat (limited to 'weed/server')
-rw-r--r--weed/server/volume_server_handlers.go6
-rw-r--r--weed/server/volume_server_handlers_read.go6
-rw-r--r--weed/server/volume_server_handlers_write.go15
3 files changed, 5 insertions, 22 deletions
diff --git a/weed/server/volume_server_handlers.go b/weed/server/volume_server_handlers.go
index e95ecc8da..fd043ad51 100644
--- a/weed/server/volume_server_handlers.go
+++ b/weed/server/volume_server_handlers.go
@@ -36,6 +36,11 @@ func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Reque
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Credentials", "true")
}
+ stats.VolumeServerRequestCounter.WithLabelValues(r.Method).Inc()
+ start := time.Now()
+ defer func() {
+ stats.VolumeServerRequestHistogram.WithLabelValues(r.Method).Observe(time.Since(start).Seconds())
+ }()
switch r.Method {
case "GET", "HEAD":
stats.ReadRequest()
@@ -56,7 +61,6 @@ func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Reque
stats.DeleteRequest()
vs.guard.WhiteList(vs.DeleteHandler)(w, r)
case "PUT", "POST":
-
contentLength := getContentLength(r)
// exclude the replication from the concurrentUploadLimitMB
if r.URL.Query().Get("type") != "replicate" && vs.concurrentUploadLimit != 0 {
diff --git a/weed/server/volume_server_handlers_read.go b/weed/server/volume_server_handlers_read.go
index eaebc1630..4208dd4fc 100644
--- a/weed/server/volume_server_handlers_read.go
+++ b/weed/server/volume_server_handlers_read.go
@@ -20,7 +20,6 @@ import (
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/images"
"github.com/seaweedfs/seaweedfs/weed/operation"
- "github.com/seaweedfs/seaweedfs/weed/stats"
"github.com/seaweedfs/seaweedfs/weed/storage"
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
"github.com/seaweedfs/seaweedfs/weed/util"
@@ -29,11 +28,6 @@ import (
var fileNameEscaper = strings.NewReplacer(`\`, `\\`, `"`, `\"`)
func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) {
-
- stats.VolumeServerRequestCounter.WithLabelValues("get").Inc()
- start := time.Now()
- defer func() { stats.VolumeServerRequestHistogram.WithLabelValues("get").Observe(time.Since(start).Seconds()) }()
-
n := new(needle.Needle)
vid, fid, filename, ext, _ := parseURLPath(r.URL.Path)
diff --git a/weed/server/volume_server_handlers_write.go b/weed/server/volume_server_handlers_write.go
index c25c40174..009980f56 100644
--- a/weed/server/volume_server_handlers_write.go
+++ b/weed/server/volume_server_handlers_write.go
@@ -11,19 +11,11 @@ import (
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/operation"
- "github.com/seaweedfs/seaweedfs/weed/stats"
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
"github.com/seaweedfs/seaweedfs/weed/topology"
)
func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) {
-
- stats.VolumeServerRequestCounter.WithLabelValues("post").Inc()
- start := time.Now()
- defer func() {
- stats.VolumeServerRequestHistogram.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)
@@ -79,13 +71,6 @@ func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) {
}
func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
-
- stats.VolumeServerRequestCounter.WithLabelValues("delete").Inc()
- start := time.Now()
- defer func() {
- stats.VolumeServerRequestHistogram.WithLabelValues("delete").Observe(time.Since(start).Seconds())
- }()
-
n := new(needle.Needle)
vid, fid, _, _, _ := parseURLPath(r.URL.Path)
volumeId, _ := needle.NewVolumeId(vid)