Commit 94bcaace authored by Ash McKenzie's avatar Ash McKenzie

Merge branch '340162-measure-cached-image-scaler-latencies' into 'master'

Measure image scaler metric when serving cached images

See merge request gitlab-org/gitlab!70483
parents 7e749491 e6333fb2
......@@ -186,12 +186,15 @@ func (r *Resizer) Inject(w http.ResponseWriter, req *http.Request, paramsData st
}
defer imageFile.reader.Close()
widthLabelVal := strconv.Itoa(int(params.Width))
outcome.originalFileSize = imageFile.contentLength
setLastModified(w, imageFile.lastModified)
// If the original file has not changed, then any cached resized versions have not changed either.
if checkNotModified(req, imageFile.lastModified) {
writeNotModified(w)
imageResizeDurations.WithLabelValues(params.ContentType, widthLabelVal).Observe(time.Since(start).Seconds())
outcome.ok(statusClientCache)
return
}
......@@ -221,7 +224,6 @@ func (r *Resizer) Inject(w http.ResponseWriter, req *http.Request, paramsData st
return
}
widthLabelVal := strconv.Itoa(int(params.Width))
imageResizeDurations.WithLabelValues(params.ContentType, widthLabelVal).Observe(time.Since(start).Seconds())
outcome.ok(statusSuccess)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment