insert request id in context
Some checks failed
codeql / analyze (go) (pull_request) Failing after 3m15s
dependabot-automerge / automerge (pull_request) Has been skipped
prbuild / test (pull_request) Failing after 1m29s
prbuild / lint (pull_request) Failing after 2m37s
autoapprove / autoapprove (pull_request) Failing after 1m26s
automerge / automerge (pull_request) Failing after 4s
Some checks failed
codeql / analyze (go) (pull_request) Failing after 3m15s
dependabot-automerge / automerge (pull_request) Has been skipped
prbuild / test (pull_request) Failing after 1m29s
prbuild / lint (pull_request) Failing after 2m37s
autoapprove / autoapprove (pull_request) Failing after 1m26s
automerge / automerge (pull_request) Failing after 4s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
74ee3bbbf1
commit
d03bf1aa14
@ -10,6 +10,8 @@ import (
|
||||
"go.unistack.org/micro/v3/util/id"
|
||||
)
|
||||
|
||||
var XRequestIDKey struct{}
|
||||
|
||||
// DefaultMetadataKey contains metadata key
|
||||
var DefaultMetadataKey = textproto.CanonicalMIMEHeaderKey("x-request-id")
|
||||
|
||||
@ -40,7 +42,8 @@ var DefaultMetadataFunc = func(ctx context.Context) (context.Context, error) {
|
||||
omd.Set(DefaultMetadataKey, v)
|
||||
ctx = metadata.NewIncomingContext(ctx, imd)
|
||||
ctx = metadata.NewOutgoingContext(ctx, omd)
|
||||
return ctx, nil
|
||||
|
||||
return context.WithValue(ctx, XRequestIDKey, v), nil
|
||||
}
|
||||
|
||||
type wrapper struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user