kitex-contrib / codec-dubbo

支持 kitex <-> dubbo 互通的 dubbo 协议编解码器。
Apache License 2.0
16 stars 14 forks source link

fix(codec): support transinfo in attachment codec #85

Closed CoderPoet closed 5 months ago

CoderPoet commented 5 months ago

What type of PR is this?

fix: https://github.com/kitex-contrib/codec-dubbo/issues/84

Check the PR title.

(Optional) Translate the PR title into Chinese.

在 attachment 编解码中支持处理 transinfo

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en: support transinfo in attachment codec zh(optional): 在 attachment 编解码器中支持 TransInfo

(Optional) Which issue(s) this PR fixes:

fix: https://github.com/kitex-contrib/codec-dubbo/issues/84

(optional) The PR that updates user documentation:

image image
GuangmingLuo commented 5 months ago

Yes, please add to _typos.toml.

CoderPoet commented 5 months ago

BTW, maybe we should exclude "go.mod" in _typos.toml. image

+1

I'll see how I can change the rules

CoderPoet commented 5 months ago

BTW, maybe we should exclude "go.mod" in _typos.toml. image

done

CoderPoet commented 5 months ago

Yes, please add to _typos.toml.

done

bytedance-oss-robot[bot] commented 5 months ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: CoderPoet, DMwangnima To complete the pull request process, please assign marina-sakai after the PR has been reviewed. You can assign the PR to them by writing /assign @marina-sakai in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/kitex-contrib/codec-dubbo/blob/main/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
nobody-s07 commented 4 months ago

This PR introduces an issue where Kitex client calls Dubbo service:

WeChat82983fe0872f5e86ef832e9cbe364fe6

The corresponding Java code is as follows, where 'attachments' is a Map with keys of type String:

image

In this PR, the attachment contains data with keys of type uint16:

        //  pkg/dubbo_spec/attachment.go:  line 56 ~ line 58
    for k, v := range transInfo.TransIntInfo() {
        result[k] = v
    }
nobody-s07 commented 4 months ago

Besides,the trace context was not correctly propagated to dubbo server side ( extracting trace context through opentelemetry-javaagent ):

image

I compared the 'attachments' received by the Dubbo service when called by the Dubbo client and the Kitex client, there are some differences in the keys within the 'attachments'. called by dubbo client: image called by kitex client: image

I made a local modification to the codec-dubbo, removing the prefix RPC_TRANSIT_, and found that the Dubbo server could correctly parse the trace context:

image

I'm not sure if directly removing the prefix(RPC_TRANSIT_) will introduce other issues, but currently, it seems that this prefix causes the Dubbo server to be unable to parse the trace context.

CoderPoet commented 4 months ago

This PR introduces an issue where Kitex client calls Dubbo service: WeChat82983fe0872f5e86ef832e9cbe364fe6

The corresponding Java code is as follows, where 'attachments' is a Map with keys of type String: image

In this PR, the attachment contains data with keys of type uint16:

        //  pkg/dubbo_spec/attachment.go:  line 56 ~ line 58
  for k, v := range transInfo.TransIntInfo() {
      result[k] = v
  }

@nobody-s07 Sorry for not having enough testing before causing the issue. This PR(https://github.com/kitex-contrib/codec-dubbo/pull/90 ) has fixed the issue, you can try again

nobody-s07 commented 4 months ago

@CoderPoet Thank you for your resolution! Now the trace context is correctly passed to the Dubbo service.

DMwangnima commented 4 months ago

@CoderPoet Thank you for your resolution! Now the trace context is correctly passed to the Dubbo service.

Hi! Thank you very much for pointing this out. Would you be interested in contributing a testcase to https://github.com/kitex-contrib/codec-dubbo-tests ?