mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -05:00
re-implement prometheus metrics endpoint to be simpler (#13922)
data-structures were repeatedly initialized this causes GC pressure, instead re-use the collectors. Initialize collectors in `init()`, also make sure to honor the cache semantics for performance requirements. Avoid a global map and a global lock for metrics lookup instead let them all be lock-free unless the cache is being invalidated.
This commit is contained in:
@@ -1113,7 +1113,7 @@ func (s *peerRESTServer) GetPeerMetrics(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
enc := gob.NewEncoder(w)
|
||||
|
||||
ch := ReportMetrics(r.Context(), GetGeneratorsForPeer)
|
||||
ch := ReportMetrics(r.Context(), peerMetricsGroups)
|
||||
for m := range ch {
|
||||
if err := enc.Encode(m); err != nil {
|
||||
s.writeErrorResponse(w, errors.New("Encoding metric failed: "+err.Error()))
|
||||
|
||||
Reference in New Issue
Block a user