diff options
-rw-r--r-- | internal/domain/domain.go | 4 | ||||
-rw-r--r-- | internal/vfs/zip/archive.go | 6 | ||||
-rw-r--r-- | internal/vfs/zip/vfs.go | 4 |
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 } |