Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2020-10-01 08:03:59 +0300
committerJaime Martinez <jmartinez@gitlab.com>2020-10-01 08:03:59 +0300
commit0f280ef9e75ceeab24722d296c78b3e6a004f981 (patch)
tree50d6359f54960b6e96d0ea43b07d720b9d630529 /internal
parentaec30ca4632f31e4921ecdc16c9f583bf57e6cbc (diff)
Rename all zip and httprange metrics
Renames all metrics to make them easier to understand. Adds a missing metric for number of open requests made by httprange.
Diffstat (limited to 'internal')
-rw-r--r--internal/httprange/http_reader.go13
-rw-r--r--internal/httprange/transport.go2
-rw-r--r--internal/vfs/zip/archive.go12
-rw-r--r--internal/vfs/zip/vfs.go2
4 files changed, 18 insertions, 11 deletions
diff --git a/internal/httprange/http_reader.go b/internal/httprange/http_reader.go
index 82c3189c..efb3b981 100644
--- a/internal/httprange/http_reader.go
+++ b/internal/httprange/http_reader.go
@@ -57,8 +57,8 @@ var httpClient = &http.Client{
Transport: &tracedTransport{
next: httptransport.NewTransportWithMetrics(
"object_storage_client",
- metrics.ObjectStorageBackendReqDuration,
- metrics.ObjectStorageBackendReqTotal,
+ metrics.HTTPRangeRequestDuration,
+ metrics.HTTPRangeRequestsTotal,
),
},
}
@@ -75,14 +75,18 @@ func (r *Reader) ensureResponse() error {
return err
}
- // TODO: add Traceln info for HTTP calls with headers and response https://gitlab.com/gitlab-org/gitlab-pages/-/issues/448
+ metrics.HTTPRangeOpenRequests.Inc()
+
res, err := httpClient.Do(req)
if err != nil {
+ metrics.HTTPRangeOpenRequests.Dec()
return err
}
err = r.setResponse(res)
if err != nil {
+ metrics.HTTPRangeOpenRequests.Dec()
+
// cleanup body on failure from r.setResponse to avoid memory leak
res.Body.Close()
}
@@ -200,6 +204,9 @@ func (r *Reader) Close() error {
// no need to read until the end
err := r.res.Body.Close()
r.res = nil
+
+ metrics.HTTPRangeOpenRequests.Dec()
+
return err
}
diff --git a/internal/httprange/transport.go b/internal/httprange/transport.go
index 1432acf9..9bb6e805 100644
--- a/internal/httprange/transport.go
+++ b/internal/httprange/transport.go
@@ -86,6 +86,6 @@ func newTracer(start time.Time) *httptrace.ClientTrace {
}
func httpTraceObserve(label string, start time.Time) {
- metrics.ObjectStorageTraceDuration.WithLabelValues(label).
+ metrics.HTTPRangeTraceDuration.WithLabelValues(label).
Observe(time.Since(start).Seconds())
}
diff --git a/internal/vfs/zip/archive.go b/internal/vfs/zip/archive.go
index 85c84a9f..1fec3903 100644
--- a/internal/vfs/zip/archive.go
+++ b/internal/vfs/zip/archive.go
@@ -63,9 +63,9 @@ func (a *zipArchive) openArchive(parentCtx context.Context) (err error) {
defer func() {
// checking named return err value
if err != nil {
- metrics.ZipServingOpenArchivesTotal.WithLabelValues("error").Inc()
+ metrics.ZipOpened.WithLabelValues("error").Inc()
} else {
- metrics.ZipServingOpenArchivesTotal.WithLabelValues("ok").Inc()
+ metrics.ZipOpened.WithLabelValues("ok").Inc()
}
}()
@@ -139,8 +139,8 @@ func (a *zipArchive) readArchive() {
a.archive.File = nil
fileCount := float64(len(a.files))
- metrics.ZipServingFilesPerArchiveTotalCount.Add(fileCount)
- metrics.ZipServingFilesPerZipArchiveCurrentlyCached.Add(fileCount)
+ metrics.ZipOpenedEntriesCount.Add(fileCount)
+ metrics.ZipArchiveEntriesCached.Add(fileCount)
}
func (a *zipArchive) findFile(name string) *zip.File {
@@ -230,6 +230,6 @@ func (a *zipArchive) Readlink(ctx context.Context, name string) (string, error)
// onEvicted called by the zipVFS.cache when an archive is removed from the cache
func (a *zipArchive) onEvicted(){
- metrics.ZipServingArchivesCurrentlyCached.Dec()
- metrics.ZipServingFilesPerZipArchiveCurrentlyCached.Sub(float64(len(a.files)))
+ metrics.ZipCachedArchives.Dec()
+ metrics.ZipArchiveEntriesCached.Sub(float64(len(a.files)))
}
diff --git a/internal/vfs/zip/vfs.go b/internal/vfs/zip/vfs.go
index 9ba6f859..a84b07ec 100644
--- a/internal/vfs/zip/vfs.go
+++ b/internal/vfs/zip/vfs.go
@@ -92,7 +92,7 @@ func (fs *zipVFS) findOrOpenArchive(ctx context.Context, path string) (*zipArchi
return nil, errAlreadyCached
}
metrics.ZipServingArchiveCache.WithLabelValues("miss").Inc()
- metrics.ZipServingArchivesCurrentlyCached.Inc()
+ metrics.ZipCachedArchives.Inc()
}
zipArchive := archive.(*zipArchive)