update for latest micro
Some checks failed
build / test (push) Failing after 50s
build / lint (push) Successful in 39s
codeql / analyze (go) (push) Failing after 1m23s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2023-10-17 01:12:17 +03:00
parent 6bb29d8d0e
commit 9c5c08c188
3 changed files with 17 additions and 5 deletions

4
go.mod
View File

@ -2,4 +2,6 @@ module go.unistack.org/micro-wrapper-requestid/v4
go 1.20
require go.unistack.org/micro/v4 v4.0.7
require go.unistack.org/micro/v4 v4.0.14
require golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect

8
go.sum
View File

@ -1,4 +1,4 @@
go.unistack.org/micro/v4 v4.0.1 h1:xo1IxbVfgh8i0eY0VeYa3cbb13u5n/Mxnp3FOgWD4Jo=
go.unistack.org/micro/v4 v4.0.1/go.mod h1:p/J5UcSJjfHsWGT31uKoghQ5rUQZzQJBAFy+Z4+ZVMs=
go.unistack.org/micro/v4 v4.0.7 h1:2lwtZlHcSwgkahhFbkI4x1lOS79lw8uLHtcEhlFF+AM=
go.unistack.org/micro/v4 v4.0.7/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk=
go.unistack.org/micro/v4 v4.0.14 h1:zN+aVfTceei3TPzuA7f2wAXLYHoSHWpx2XgW8yqaTIA=
go.unistack.org/micro/v4 v4.0.14/go.mod h1:ZDgU9931vm2l7X6RN/6UuwRIVp24GRdmQ7dKmegArk4=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=

View File

@ -5,12 +5,22 @@ import (
"net/textproto"
"go.unistack.org/micro/v4/client"
"go.unistack.org/micro/v4/logger"
"go.unistack.org/micro/v4/metadata"
"go.unistack.org/micro/v4/options"
"go.unistack.org/micro/v4/server"
"go.unistack.org/micro/v4/util/id"
)
func init() {
logger.DefaultContextAttrFuncs = append(logger.DefaultContextAttrFuncs, func(ctx context.Context) []interface{} {
if v, ok := ctx.Value(XRequestIDKey).(string); ok {
return []interface{}{DefaultMetadataKey, v}
}
return nil
})
}
var XRequestIDKey struct{}
// DefaultMetadataKey contains metadata key x-request-id