[#XX] Pass request id to tree pool

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2023-10-10 17:18:38 +03:00
parent dec4e4ea8a
commit b2f51fcd84
4 changed files with 7 additions and 4 deletions

View file

@ -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
}
}

View file

@ -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))

2
go.mod
View file

@ -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

4
go.sum
View file

@ -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=