From b2f51fcd847037d0a721ccdceecfc5206e37a520 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 10 Oct 2023 17:18:38 +0300 Subject: [PATCH] [#XX] Pass request id to tree pool Signed-off-by: Denis Kirillov --- api/handler/get.go | 2 +- api/middleware/reqinfo.go | 3 +++ go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/handler/get.go b/api/handler/get.go index 86d5b9c2..082fac4e 100644 --- a/api/handler/get.go +++ b/api/handler/get.go @@ -227,7 +227,7 @@ func (h *handler) GetObjectHandler(w http.ResponseWriter, r *http.Request) { } if err = objPayload.StreamTo(w); err != nil { - h.logAndSendError(w, "could not stream object payload", reqInfo, err) + h.logAndSendError(w, "could not stream object payload", reqInfo, err, zap.String("http ctx error", r.Context().Err().Error())) return } } diff --git a/api/middleware/reqinfo.go b/api/middleware/reqinfo.go index 0388dca4..0a96ca82 100644 --- a/api/middleware/reqinfo.go +++ b/api/middleware/reqinfo.go @@ -10,6 +10,7 @@ import ( "sync" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/logs" + treepool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree" "github.com/go-chi/chi/v5" "github.com/google/uuid" "go.uber.org/zap" @@ -206,6 +207,8 @@ func Request(log *zap.Logger) Func { r.Context(), HdrAmzRequestID, reqInfo.RequestID, )) + r = r.WithContext(treepool.SetRequestID(r.Context(), reqInfo.RequestID)) + reqLogger := log.With(zap.String("request_id", reqInfo.RequestID)) r = r.WithContext(SetReqLogger(r.Context(), reqLogger)) diff --git a/go.mod b/go.mod index ccdbc274..6d83758d 100644 --- a/go.mod +++ b/go.mod @@ -96,4 +96,4 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace git.frostfs.info/TrueCloudLab/frostfs-sdk-go => git.frostfs.info/alexvanin/frostfs-sdk-go v0.0.0-20231010083929-308bdcc2f50b +replace git.frostfs.info/TrueCloudLab/frostfs-sdk-go => git.frostfs.info/dkirillov/frostfs-sdk-go v0.0.0-20231010135927-24862a9332ab diff --git a/go.sum b/go.sum index 6bfeb6a1..ea5cac64 100644 --- a/go.sum +++ b/go.sum @@ -50,8 +50,8 @@ git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9m git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc= git.frostfs.info/TrueCloudLab/tzhash v1.8.0 h1:UFMnUIk0Zh17m8rjGHJMqku2hCgaXDqjqZzS4gsb4UA= git.frostfs.info/TrueCloudLab/tzhash v1.8.0/go.mod h1:dhY+oy274hV8wGvGL4MwwMpdL3GYvaX1a8GQZQHvlF8= -git.frostfs.info/alexvanin/frostfs-sdk-go v0.0.0-20231010083929-308bdcc2f50b h1:rFtO5IiIFqmEYHpGsUJFbDcy+6zK5misV64mrIxboIU= -git.frostfs.info/alexvanin/frostfs-sdk-go v0.0.0-20231010083929-308bdcc2f50b/go.mod h1:t1akKcUH7iBrFHX8rSXScYMP17k2kYQXMbZooiL5Juw= +git.frostfs.info/dkirillov/frostfs-sdk-go v0.0.0-20231010135927-24862a9332ab h1:Oe0dyYyiTjp/EAV/GGhc7M+3Wn1LuFBTbzkwfqSpEQM= +git.frostfs.info/dkirillov/frostfs-sdk-go v0.0.0-20231010135927-24862a9332ab/go.mod h1:t1akKcUH7iBrFHX8rSXScYMP17k2kYQXMbZooiL5Juw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0=