Add traceId to the response headers (#919)

* Add traceId to the request headers

* Add test cases

* Update refactor code
This commit is contained in:
chenquan
2021-08-17 10:12:08 +08:00
committed by GitHub
parent 14ec29991c
commit 7c842f22d0
7 changed files with 24 additions and 15 deletions

View File

@@ -21,6 +21,8 @@ func TracingHandler(next http.Handler) http.Handler {
defer span.Finish()
r = r.WithContext(ctx)
// Conveniently track error messages
w.Header().Set(trace.TraceIdKey, span.TraceId())
next.ServeHTTP(w, r)
})
}