Skip to content

Commit 8d8cdbf

Browse files
aledbfroboquat
authored andcommitted
[registry-facade] Add additional GetBlob error logs
1 parent 01314b5 commit 8d8cdbf

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

components/registry-facade/pkg/registry/blob.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,13 @@ func (bh *blobHandler) getBlob(w http.ResponseWriter, r *http.Request) {
172172

173173
n, err := io.CopyBuffer(w, rc, *bp)
174174
if err != nil {
175-
log.WithError(err).Error("unable to return blob")
175+
bh.Metrics.BlobDownloadCounter.WithLabelValues(src.Name(), "false").Inc()
176+
log.WithField("blobSource", src.Name()).WithField("baseRef", bh.Spec.BaseRef).WithError(err).Error("unable to return blob")
176177
return err
177178
}
178179

179180
bh.Metrics.BlobDownloadSpeedHist.WithLabelValues(src.Name()).Observe(float64(n) / time.Since(t0).Seconds())
180-
bh.Metrics.BlobDownloadCounter.WithLabelValues(src.Name()).Inc()
181+
bh.Metrics.BlobDownloadCounter.WithLabelValues(src.Name(), "true").Inc()
181182
bh.Metrics.BlobDownloadSizeCounter.WithLabelValues(src.Name()).Add(float64(n))
182183

183184
if dontCache {

components/registry-facade/pkg/registry/metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func newMetrics(reg prometheus.Registerer, upstream bool) (*metrics, error) {
9393
blobDownloadCounter := prometheus.NewCounterVec(prometheus.CounterOpts{
9494
Name: "blob_req_dl_total",
9595
Help: "number of blob download requests",
96-
}, []string{"blobSource"})
96+
}, []string{"blobSource", "ok"})
9797
err = reg.Register(blobDownloadCounter)
9898
if err != nil {
9999
return nil, err

0 commit comments

Comments
 (0)