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:
authorErcan Ucan <ercan.ucan@siemens.com>2021-02-23 18:35:37 +0300
committerErcan Ucan <ercan.ucan@siemens.com>2021-02-24 17:37:16 +0300
commitae9a8fb5304fca0a1dc0441cb991227320033bca (patch)
tree0ca630df4863298dba0a2f493e91f58b94deda99 /internal/auth/auth.go
parent808300edb233f751aa6bb6abc8275774ffce936e (diff)
fix: use correlationID middleware
As discussed within https://gitlab.com/gitlab-org/gitlab-pages/-/issues/510 this MR adds the usage of labkit's correlationID middleware. It uses a similar approach to the implemantion in gitlab-workhorse. Fixes https://gitlab.com/gitlab-org/gitlab-pages/-/issues/510 :tools: with :heart: at Siemens Changelog: fixed
Diffstat (limited to 'internal/auth/auth.go')
-rw-r--r--internal/auth/auth.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/auth/auth.go b/internal/auth/auth.go
index 2fdcbeb3..da35ba51 100644
--- a/internal/auth/auth.go
+++ b/internal/auth/auth.go
@@ -18,6 +18,7 @@ import (
log "github.com/sirupsen/logrus"
"golang.org/x/crypto/hkdf"
+ "gitlab.com/gitlab-org/labkit/correlation"
"gitlab.com/gitlab-org/labkit/errortracking"
"gitlab.com/gitlab-org/gitlab-pages/internal/httperrors"
@@ -617,9 +618,10 @@ func checkResponseForInvalidToken(resp *http.Response, session *sessions.Session
func logRequest(r *http.Request) *log.Entry {
state := r.URL.Query().Get("state")
return log.WithFields(log.Fields{
- "host": r.Host,
- "path": r.URL.Path,
- "state": state,
+ "correlation_id": correlation.ExtractFromContext(r.Context()),
+ "host": r.Host,
+ "path": r.URL.Path,
+ "state": state,
})
}