From 68619d5ada68841123722e80f973e9719f8d8306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Wed, 20 Dec 2023 08:15:07 +0100 Subject: [PATCH 1/2] Also log the traceid alongside the request id --- services/proxy/pkg/middleware/accesslog.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/proxy/pkg/middleware/accesslog.go b/services/proxy/pkg/middleware/accesslog.go index 00afc71c436..e51faeb4bb0 100644 --- a/services/proxy/pkg/middleware/accesslog.go +++ b/services/proxy/pkg/middleware/accesslog.go @@ -6,6 +6,7 @@ import ( "github.com/go-chi/chi/v5/middleware" "github.com/owncloud/ocis/v2/ocis-pkg/log" + "go.opentelemetry.io/otel/trace" ) // AccessLog is a middleware to log http requests at info level logging. @@ -19,9 +20,11 @@ func AccessLog(logger log.Logger) func(http.Handler) http.Handler { wrap := middleware.NewWrapResponseWriter(w, r.ProtoMajor) next.ServeHTTP(wrap, r) + spanContext := trace.SpanContextFromContext(r.Context()) logger.Info(). Str("proto", r.Proto). Str(log.RequestIDString, requestID). + Str("traceid", spanContext.TraceID().String()). Str("remote-addr", r.RemoteAddr). Str("method", r.Method). Int("status", wrap.Status()). From 2a91c311cb5f58cb44ba251ec385242582327414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Wed, 20 Dec 2023 08:16:22 +0100 Subject: [PATCH 2/2] Add changelog --- changelog/unreleased/fix-empty-traceids.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog/unreleased/fix-empty-traceids.md b/changelog/unreleased/fix-empty-traceids.md index 6a7658db3a1..f758c15b682 100644 --- a/changelog/unreleased/fix-empty-traceids.md +++ b/changelog/unreleased/fix-empty-traceids.md @@ -2,4 +2,5 @@ Bugfix: Fix empty trace ids We changed the default tracing to produce non-empty traceids. +https://github.com/owncloud/ocis/pull/8023 https://github.com/owncloud/ocis/pull/8017