Skip to content

Commit

Permalink
Merge pull request #681 from deniszh/dzhdanov/list_metric_info
Browse files Browse the repository at this point in the history
Adding info output for /metric/list handler
  • Loading branch information
deniszh authored Jan 15, 2025
2 parents ef3b20d + 89dfd40 commit aeccd08
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions carbonserver/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ func (listener *CarbonserverListener) listHandler(wr http.ResponseWriter, req *h
var err error

metrics, err := listener.getMetricsList()
accessLogger.Info("list acquired",
zap.Duration("runtime_seconds", time.Since(t0)),
zap.Int("length", len(metrics)),
)
if err != nil {
accessLogger.Error("list failed",
zap.Duration("runtime_seconds", time.Since(t0)),
Expand All @@ -109,6 +113,10 @@ func (listener *CarbonserverListener) listHandler(wr http.ResponseWriter, req *h
}
b, err = response.MarshalVT()
}
accessLogger.Info("list formatted",
zap.Duration("runtime_seconds", time.Since(t0)),
zap.Int("length", len(b)),
)

if err != nil {
accessLogger.Error("list failed",
Expand All @@ -120,10 +128,11 @@ func (listener *CarbonserverListener) listHandler(wr http.ResponseWriter, req *h
return
}
wr.Header().Set("Content-Type", contentType)
wr.Write(b)

writtenBytes, err := wr.Write(b)
accessLogger.Info("list served",
zap.Duration("runtime_seconds", time.Since(t0)),
zap.Int("write", writtenBytes),
zap.Error(err),
)
}

Expand Down

0 comments on commit aeccd08

Please sign in to comment.