mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(master): enhance error handling in getVolSimpleInfo by logging failures and updating metrics. #1000337685
Signed-off-by: Victor1319 <zengxuewei@oppo.com>
This commit is contained in:
parent
37db5cf3b1
commit
f47bc8ba9e
@ -3108,6 +3108,13 @@ func (m *Server) getVolSimpleInfo(w http.ResponseWriter, r *http.Request) {
|
||||
)
|
||||
metric := exporter.NewTPCnt("req" + strings.Replace(proto.AdminGetVol, "/", "_", -1))
|
||||
defer func() {
|
||||
if err != nil {
|
||||
msg := fmt.Sprintf("getVolSimpleInfo: vol(%v) failed, remoteAddr(%s), srcRealIp(%s), err (%s)",
|
||||
name, r.RemoteAddr, iputil.GetRealClientIP(r), err.Error())
|
||||
auditlog.LogMasterOp(proto.AdminGetVol, msg, err)
|
||||
exporter.NewCounter("getVolFailed").Add(1)
|
||||
return
|
||||
}
|
||||
doStatAndMetric(proto.AdminGetVol, metric, err, map[string]string{exporter.Vol: name})
|
||||
}()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user