diff options
| author | Taras Madan <tarasmadan@google.com> | 2024-11-04 11:30:19 +0100 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2024-11-04 11:47:46 +0000 |
| commit | 7bfecfb91238ca7d15ec9dc565b887278b8160be (patch) | |
| tree | effe9af7a709252e9b8320b38b0419485191fcb8 | |
| parent | 2c4d2e02c3ededab70593ceb9631a2b551823be1 (diff) | |
dashboard/api: log trace id and return it to the client
It allows to later get all the associated records in logs explorer.
| -rw-r--r-- | dashboard/app/handler.go | 12 | ||||
| -rw-r--r-- | dashboard/app/templates/error.html | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/dashboard/app/handler.go b/dashboard/app/handler.go index 4213d4eaf..e737c2b0b 100644 --- a/dashboard/app/handler.go +++ b/dashboard/app/handler.go @@ -43,11 +43,13 @@ func handleContext(fn contextHandler) http.Handler { if err := fn(c, w, r); err != nil { hdr := commonHeaderRaw(c, r) data := &struct { - Header *uiHeader - Error string + Header *uiHeader + Error string + TraceID string }{ - Header: hdr, - Error: err.Error(), + Header: hdr, + Error: err.Error(), + TraceID: strings.Join(r.Header["X-Cloud-Trace-Context"], " "), } if err == ErrAccess { if hdr.LoginLink != "" { @@ -83,7 +85,7 @@ func logErrorPrepareStatus(c context.Context, err error) int { logf = log.Warningf status = clientError.HTTPStatus() } - logf(c, "%v", err) + logf(c, "appengine error: %v", err) return status } diff --git a/dashboard/app/templates/error.html b/dashboard/app/templates/error.html index 7bab98186..0c8161ef4 100644 --- a/dashboard/app/templates/error.html +++ b/dashboard/app/templates/error.html @@ -5,6 +5,8 @@ <title>syzbot</title> </head> <body> + traceID: {{.TraceID}} + <br> {{.Error}} <br> <a href="javascript:history.back()">back</a> |
