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 /internal/httperrors | |
parent | e74c91bfe5c95d6da82691e0c753cc50b661613c (diff) |
Improve logging and correlation ID
Diffstat (limited to 'internal/httperrors')
-rw-r--r-- | internal/httperrors/httperrors.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/httperrors/httperrors.go b/internal/httperrors/httperrors.go index 476d270c..ed56ee10 100644 --- a/internal/httperrors/httperrors.go +++ b/internal/httperrors/httperrors.go @@ -4,9 +4,9 @@ import ( "fmt" "net/http" - log "github.com/sirupsen/logrus" - + "gitlab.com/gitlab-org/labkit/correlation" "gitlab.com/gitlab-org/labkit/errortracking" + "gitlab.com/gitlab-org/labkit/log" ) type content struct { @@ -184,8 +184,9 @@ func Serve500(w http.ResponseWriter) { // Serve500WithRequest returns a 500 error response / HTML page to the http.ResponseWriter func Serve500WithRequest(w http.ResponseWriter, r *http.Request, reason string, err error) { log.WithFields(log.Fields{ - "host": r.Host, - "path": r.URL.Path, + "correlation_id": correlation.ExtractFromContext(r.Context()), + "host": r.Host, + "path": r.URL.Path, }).WithError(err).Error(reason) errortracking.Capture(err, errortracking.WithRequest(r)) serveErrorPage(w, content500) |