From 44080aa5f8706d69fbddf8e80bfc5efa1a5835bf Mon Sep 17 00:00:00 2001 From: Muhammad Shidiq Date: Tue, 12 Nov 2024 17:40:46 +0700 Subject: [PATCH] rest middleware: add trace_id into the log buffer --- codebase/app/rest_server/middleware.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codebase/app/rest_server/middleware.go b/codebase/app/rest_server/middleware.go index b9cd6c8..f2c8575 100644 --- a/codebase/app/rest_server/middleware.go +++ b/codebase/app/rest_server/middleware.go @@ -216,6 +216,9 @@ func HTTPMiddlewareTracer() func(http.Handler) http.Handler { logBuff.WriteString(`,"latency":"`) logBuff.WriteString(stop.Sub(start).String()) + logBuff.WriteString(`","trace_id":"`) + logBuff.WriteString(tracer.GetTraceID(ctx)) + logBuff.WriteString(`","bytes_in":`) cl := req.Header.Get("Content-Length") if cl == "" {