diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2021-07-07 05:19:48 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2021-07-07 05:19:48 +0300 |
commit | 86afc1dfeeb07fbc140d08ef8cdcfd8cbd4d7bcb (patch) | |
tree | 41a2d15d113a8dba2513ca42d9c82722d1c5892b /app.go | |
parent | e74c91bfe5c95d6da82691e0c753cc50b661613c (diff) |
Improve logging and correlation ID
Diffstat (limited to 'app.go')
-rw-r--r-- | app.go | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -12,7 +12,7 @@ import ( ghandlers "github.com/gorilla/handlers" "github.com/rs/cors" - log "github.com/sirupsen/logrus" + "gitlab.com/gitlab-org/labkit/log" "gitlab.com/gitlab-org/go-mimedb" "gitlab.com/gitlab-org/labkit/correlation" @@ -346,11 +346,17 @@ func (a *theApp) buildHandlerPipeline() (http.Handler, error) { // Custom response headers handler = a.customHeadersMiddleware(handler) + //handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // fmt.Printf("the req headers: %+v\n", r.Header) + // fmt.Printf("the correlationID must have been here: %q\n", correlation.ExtractFromContext(r.Context())) + // handler.ServeHTTP(w, r) + // return + //}) // Correlation ID injection middleware var correlationOpts []correlation.InboundHandlerOption if a.config.General.PropagateCorrelationID { - correlationOpts = append(correlationOpts, correlation.WithPropagation()) + correlationOpts = append(correlationOpts, correlation.WithPropagation(), correlation.WithSetResponseHeader()) } handler = correlation.InjectCorrelationID(handler, correlationOpts...) |