diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2020-06-09 10:18:00 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2020-06-09 10:18:00 +0300 |
commit | ea75c36b1220b4d741d26a7963b4afb50ebded56 (patch) | |
tree | 871ee0ad68de9cd726269822dd627a7a3e78277e /internal/serving | |
parent | e96f9d00469050d3548ee45928b2a5b6733a3a7d (diff) |
Use histogram without labels
Register ServingTime.
Rename DiskServingFileSize so that it's a histogram without
needing labels
Diffstat (limited to 'internal/serving')
-rw-r--r-- | internal/serving/disk/reader.go | 6 | ||||
-rw-r--r-- | internal/serving/disk/serving.go | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/internal/serving/disk/reader.go b/internal/serving/disk/reader.go index 83fe3378..b8dce542 100644 --- a/internal/serving/disk/reader.go +++ b/internal/serving/disk/reader.go @@ -17,7 +17,7 @@ import ( // Reader is a disk access driver type Reader struct { - fileSizeMetric *prometheus.HistogramVec + fileSizeMetric prometheus.Histogram } func (reader *Reader) tryFile(h serving.Handler) error { @@ -144,7 +144,7 @@ func (reader *Reader) serveFile(w http.ResponseWriter, r *http.Request, origPath return err } - reader.fileSizeMetric.With(prometheus.Labels{"serving_type": "disk", "content_type": contentType}).Observe(float64(fi.Size())) + reader.fileSizeMetric.Observe(float64(fi.Size())) w.Header().Set("Content-Type", contentType) http.ServeContent(w, r, origPath, fi.ModTime(), file) @@ -172,7 +172,7 @@ func (reader *Reader) serveCustomFile(w http.ResponseWriter, r *http.Request, co return err } - reader.fileSizeMetric.With(prometheus.Labels{"serving_type": "disk", "content_type": contentType}).Observe(float64(fi.Size())) + reader.fileSizeMetric.Observe(float64(fi.Size())) w.Header().Set("Content-Type", contentType) w.Header().Set("Content-Length", strconv.FormatInt(fi.Size(), 10)) diff --git a/internal/serving/disk/serving.go b/internal/serving/disk/serving.go index 94a6d001..f5ec0d78 100644 --- a/internal/serving/disk/serving.go +++ b/internal/serving/disk/serving.go @@ -8,7 +8,7 @@ import ( var disk = &Disk{ reader: Reader{ - fileSizeMetric: metrics.ServingFileSize, + fileSizeMetric: metrics.DiskServingFileSize, }, } |