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:
authorVishal Tak <vtak@gitlab.com>2022-04-28 13:33:13 +0300
committerVishal Tak <vtak@gitlab.com>2022-05-16 10:44:42 +0300
commitb81fb34509a9e9754e75975ea8152691fa4c9d10 (patch)
tree18a10c01d5194f40bd46c9663cca1832b74f0f63
parent433eb42cb475239fbc9a9af7be4bff01fc2d0a63 (diff)
Add logs for more visibility in 404s and archive corruption event
-rw-r--r--internal/domain/domain.go4
-rw-r--r--internal/vfs/zip/archive.go6
-rw-r--r--internal/vfs/zip/vfs.go4
3 files changed, 14 insertions, 0 deletions
diff --git a/internal/domain/domain.go b/internal/domain/domain.go
index 76a1cf25..f6022b35 100644
--- a/internal/domain/domain.go
+++ b/internal/domain/domain.go
@@ -9,6 +9,7 @@ import (
"gitlab.com/gitlab-org/gitlab-pages/internal/errortracking"
"gitlab.com/gitlab-org/gitlab-pages/internal/httperrors"
+ "gitlab.com/gitlab-org/gitlab-pages/internal/logging"
"gitlab.com/gitlab-org/gitlab-pages/internal/serving"
)
@@ -126,6 +127,7 @@ func (d *Domain) ServeFileHTTP(w http.ResponseWriter, r *http.Request) bool {
if err != nil {
if errors.Is(err, ErrDomainDoesNotExist) {
// serve generic 404
+ logging.LogRequest(r).WithError(ErrDomainDoesNotExist).Error("unable to find any lookup path for domain while serving file")
httperrors.Serve404(w)
return true
}
@@ -144,6 +146,7 @@ func (d *Domain) ServeNotFoundHTTP(w http.ResponseWriter, r *http.Request) {
if err != nil {
if errors.Is(err, ErrDomainDoesNotExist) {
// serve generic 404
+ logging.LogRequest(r).WithError(ErrDomainDoesNotExist).Error("unable to find any lookup path for domain while serving the not found pages")
httperrors.Serve404(w)
return
}
@@ -168,6 +171,7 @@ func (d *Domain) ServeNamespaceNotFound(w http.ResponseWriter, r *http.Request)
if err != nil {
if errors.Is(err, ErrDomainDoesNotExist) {
// serve generic 404
+ logging.LogRequest(r).WithError(ErrDomainDoesNotExist).Error("unable to find any lookup path for domain while finding parent namespace domain for a request that failed authentication")
httperrors.Serve404(w)
return
}
diff --git a/internal/vfs/zip/archive.go b/internal/vfs/zip/archive.go
index c44f45ef..0a9ac0d7 100644
--- a/internal/vfs/zip/archive.go
+++ b/internal/vfs/zip/archive.go
@@ -121,6 +121,9 @@ func (a *zipArchive) readArchive(url string) {
a.resource, a.err = httprange.NewResource(ctx, url, a.fs.httpClient)
if a.err != nil {
+ log.WithFields(log.Fields{
+ "url": url,
+ }).WithError(a.err).Infoln("read zip archive request failed")
metrics.ZipOpened.WithLabelValues("error").Inc()
return
}
@@ -132,6 +135,9 @@ func (a *zipArchive) readArchive(url string) {
})
if a.archive == nil || a.err != nil {
+ log.WithFields(log.Fields{
+ "url": url,
+ }).WithError(a.err).Infoln("loading zip archive files into memory failed")
metrics.ZipOpened.WithLabelValues("error").Inc()
return
}
diff --git a/internal/vfs/zip/vfs.go b/internal/vfs/zip/vfs.go
index 3fcef556..b87b7822 100644
--- a/internal/vfs/zip/vfs.go
+++ b/internal/vfs/zip/vfs.go
@@ -9,6 +9,7 @@ import (
"time"
"github.com/patrickmn/go-cache"
+ "gitlab.com/gitlab-org/labkit/log"
"gitlab.com/gitlab-org/gitlab-pages/internal/config"
"gitlab.com/gitlab-org/gitlab-pages/internal/httpfs"
@@ -208,6 +209,9 @@ func (zfs *zipVFS) findOrCreateArchive(key string) (*zipArchive, error) {
case archiveCorrupted:
// this means that archive is likely changed
// we should invalidate it immediately
+ log.WithFields(log.Fields{
+ "archive_key": key,
+ }).Error("archive corrupted")
metrics.ZipCacheRequests.WithLabelValues("archive", "corrupted").Inc()
archive = nil
}