SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
[filer] replace an invalid methods in a metric with an invalid one (#5378)
Konstantin Lebedev54ee73287d03
diff --git a/weed/server/filer_server_handlers.go b/weed/server/filer_server_handlers.goindex b5e070fb21..33f63f65a7 100644--- a/weed/server/filer_server_handlers.go+++ b/weed/server/filer_server_handlers.go@@ -63,11 +63,11 @@ func (fs *FilerServer) filerHandler(w http.ResponseWriter, r *http.Request) {stats.FilerRequestHistogram.WithLabelValues(stats.ChunkProxy).Observe(time.Since(start).Seconds())return}-- defer func() {- stats.FilerRequestCounter.WithLabelValues(r.Method, strconv.Itoa(statusRecorder.Status)).Inc()- stats.FilerRequestHistogram.WithLabelValues(r.Method).Observe(time.Since(start).Seconds())- }()+ requestMethod := r.Method+ defer func(method *string) {+ stats.FilerRequestCounter.WithLabelValues(*method, strconv.Itoa(statusRecorder.Status)).Inc()+ stats.FilerRequestHistogram.WithLabelValues(*method).Observe(time.Since(start).Seconds())+ }(&requestMethod)isReadHttpCall := r.Method == http.MethodGet || r.Method == http.MethodHeadif !fs.maybeCheckJwtAuthorization(r, !isReadHttpCall) {@@ -113,6 +113,7 @@ func (fs *FilerServer) filerHandler(w http.ResponseWriter, r *http.Request) {fs.PostHandler(w, r, contentLength)}default:+ requestMethod = "INVALID"w.WriteHeader(http.StatusMethodNotAllowed)}}@@ -146,11 +147,11 @@ func (fs *FilerServer) readonlyFilerHandler(w http.ResponseWriter, r *http.Requew.Header().Set("Access-Control-Allow-Headers", "OPTIONS, GET, HEAD")w.Header().Set("Access-Control-Allow-Credentials", "true")}-- defer func() {- stats.FilerRequestCounter.WithLabelValues(r.Method, strconv.Itoa(statusRecorder.Status)).Inc()- stats.FilerRequestHistogram.WithLabelValues(r.Method).Observe(time.Since(start).Seconds())- }()+ requestMethod := r.Method+ defer func(method *string) {+ stats.FilerRequestCounter.WithLabelValues(*method, strconv.Itoa(statusRecorder.Status)).Inc()+ stats.FilerRequestHistogram.WithLabelValues(*method).Observe(time.Since(start).Seconds())+ }(&requestMethod)// We handle OPTIONS first because it never should be authenticatedif r.Method == http.MethodOptions {OptionsHandler(w, r, true)@@ -168,6 +169,7 @@ func (fs *FilerServer) readonlyFilerHandler(w http.ResponseWriter, r *http.Requecase http.MethodGet, http.MethodHead:fs.GetOrHeadHandler(w, r)default:+ requestMethod = "INVALID"w.WriteHeader(http.StatusMethodNotAllowed)}}