From 0ef686bf99f5bf1d731b933148527083964c071d Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Thu, 29 Aug 2024 11:37:51 +1000 Subject: [PATCH] fix: scope ingress logs with the request signature (#2533) Fixes #2517 --- backend/controller/ingress/handler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/controller/ingress/handler.go b/backend/controller/ingress/handler.go index 47207dacc0..2bcc3c433b 100644 --- a/backend/controller/ingress/handler.go +++ b/backend/controller/ingress/handler.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "net/http" "time" @@ -30,8 +31,8 @@ func Handle( r *http.Request, call func(context.Context, *connect.Request[ftlv1.CallRequest], optional.Option[model.RequestKey], optional.Option[model.RequestKey], string) (*connect.Response[ftlv1.CallResponse], error), ) { - logger := log.FromContext(r.Context()) - logger.Debugf("%s %s", r.Method, r.URL.Path) + logger := log.FromContext(r.Context()).Scope(fmt.Sprintf("ingress:%s:%s", r.Method, r.URL.Path)) + logger.Debugf("Start ingress request") route, err := GetIngressRoute(routes, r.Method, r.URL.Path) if err != nil { if errors.Is(err, dalerrs.ErrNotFound) {