Skip to content

Commit

Permalink
chore: optimize the code (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenquan authored Jul 1, 2023
1 parent d3d8648 commit d58801d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rest/internal/handler/tag_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ func TagHandler(tagHeader string) func(next http.Handler) http.Handler {
}

func newBaggage(ctx context.Context, request *http.Request, tagHeader string) context.Context {
span := trace.SpanFromContext(ctx)
tagString := request.Header.Get(tagHeader)
if len(tagString) == 0 {
return ctx
}
ctx = tag.ContextWithTag(ctx, tagString)

logx.WithContext(ctx).Debugw("flow staining...", logx.Field(tag.Key, tagString))

ctx = tag.ContextWithTag(ctx, tagString)
span := trace.SpanFromContext(ctx)
span.SetAttributes(httpTagAttributeKey.String(tagString))

return ctx
Expand Down
4 changes: 2 additions & 2 deletions zrpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func init() {

func MustNewClient(c RpcClientConf, options ...ClientOption) Client {
svcCfg := fmt.Sprintf(`{"loadBalancingPolicy":"%s"}`, p2c.Name)
options = append(options,
zrpc.WithDialOption(grpc.WithDefaultServiceConfig(svcCfg)),
options = append([]ClientOption{zrpc.WithDialOption(grpc.WithDefaultServiceConfig(svcCfg))},
options...,
)
return zrpc.MustNewClient(c.RpcClientConf, options...)
}
Expand Down

0 comments on commit d58801d

Please sign in to comment.