Skip to content

Commit

Permalink
logging middleware: log trace_id only if sampled
Browse files Browse the repository at this point in the history
  • Loading branch information
npazosmendez committed Jun 7, 2024
1 parent 5141842 commit 242d255
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion middleware/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func NewLogMiddleware(log log.Logger, logRequestHeaders bool, logRequestAtInfoLe
// logWithRequest information from the request and context as fields.
func (l Log) logWithRequest(r *http.Request) log.Logger {
localLog := l.Log
traceID, ok := tracing.ExtractTraceID(r.Context())
traceID, ok := tracing.ExtractSampledTraceID(r.Context())
if ok {
localLog = log.With(localLog, "trace_id", traceID)
}
Expand Down

0 comments on commit 242d255

Please sign in to comment.