Merge pull request #2634 from kmlebedev/errorMetrics

error metrics for filer and store
This commit is contained in:
Chris Lu
2022-02-04 22:35:13 -08:00
committed by GitHub
3 changed files with 18 additions and 0 deletions

View File

@@ -162,6 +162,7 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
if offset+size <= int64(len(entry.Content)) {
_, err := writer.Write(entry.Content[offset : offset+size])
if err != nil {
stats.FilerRequestCounter.WithLabelValues("write.entry.failed").Inc()
glog.Errorf("failed to write entry content: %v", err)
}
return err
@@ -173,6 +174,7 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
Directory: dir,
Name: name,
}); err != nil {
stats.FilerRequestCounter.WithLabelValues("read.cache.failed").Inc()
glog.Errorf("CacheRemoteObjectToLocalCluster %s: %v", entry.FullPath, err)
return fmt.Errorf("cache %s: %v", entry.FullPath, err)
} else {
@@ -182,6 +184,7 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
err = filer.StreamContent(fs.filer.MasterClient, writer, chunks, offset, size)
if err != nil {
stats.FilerRequestCounter.WithLabelValues("read.stream.failed").Inc()
glog.Errorf("failed to stream content %s: %v", r.URL, err)
}
return err