Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]feat: support custom ctx key to pass in servicei inline #1709

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/consts/ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const (
)

const (
SERVICE_INLINE_RPCINFO_KEY = "SERVICE_INLINE_RPCINFO_KEY"
SERVICE_INLINE_SERVICE_NAME = "SERVICE_INLINE_SERVICE_NAME"
SERVICE_INLINE_DATA_KEY = "SERVICE_INLINE_DATA_KEY"
SERVICE_INLINE_RPCINFO_KEY = "SERVICE_INLINE_RPCINFO_KEY"
SERVICE_INLINE_SERVICE_NAME = "SERVICE_INLINE_SERVICE_NAME"
SERVICE_INLINE_DATA_KEY = "SERVICE_INLINE_DATA_KEY"
SERVICE_INLINE_CUSTOM_CTX_KEY = "SERVICE_INLINE_CUSTOM_CTX_KEY"
)
4 changes: 4 additions & 0 deletions server/service_inline.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@

func constructServerCtxWithMetadata(cliCtx context.Context) (serverCtx context.Context) {
serverCtx = context.Background()
customVal := cliCtx.Value(consts.SERVICE_INLINE_CUSTOM_CTX_KEY)
if customVal != nil {
serverCtx = context.WithValue(serverCtx, consts.SERVICE_INLINE_CUSTOM_CTX_KEY, customVal)

Check failure on line 42 in server/service_inline.go

View workflow job for this annotation

GitHub Actions / golangci-lint

SA1029: should not use built-in type string as key for value; define your own type to avoid collisions (staticcheck)
}

Check warning on line 43 in server/service_inline.go

View check run for this annotation

Codecov / codecov/patch

server/service_inline.go#L42-L43

Added lines #L42 - L43 were not covered by tests
// metainfo
// forward transmission
kvs := make(map[string]string, 16)
Expand Down
Loading