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

解决【dubbo3.0子调用mock结果为null,取不到录制数据】的问题 https://github.com/arextest/are… #491

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JCACJY
Copy link

@JCACJY JCACJY commented May 28, 2024

fix #490

可能带来的影响面:
●对dubbo2.0、dubbo3.0的兼容性;
●同时补全对group和version的支持;优化后的完整服务名格式:group/interface:version
●对【忽略mock配置】带来的影响,新的ignore mock path格式可能会导致旧的配置失效;
另外:
如果接受PR,请更新该章节中dubbo服务名的配置说明,最好给出案例

@mr3
Copy link
Collaborator

mr3 commented May 30, 2024

@lucas-myx PTAL.
@JCACJY Please fix the unit test

String version = this.getAttachment("version");
// splicing:group/interface:version
StringBuilder serviceKey = new StringBuilder();
if (!StringUtil.isBlank(group)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!StringUtil.isBlank -> StringUtil.isNotEmpty

serviceKey.append(group).append("/");
}
serviceKey.append(serviceName);
if (!StringUtil.isBlank(version)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!StringUtil.isBlank -> StringUtil.isNotEmpty

@@ -38,7 +38,11 @@ public static DubboAdapter of(Invoker<?> invoker, Invocation invocation) {

@Override
public String getServiceName() {
Copy link
Collaborator

@lucas-myx lucas-myx Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/**
  * format:group/interface:version
  * method:org.alibaba.dubbo.common.URL#buildKey()
  */
 @Override
 public String getServiceName() {

@@ -34,6 +34,7 @@ public static DubboAdapter of(Invoker<?> invoker, Invocation invocation) {

@Override
public String getServiceName() {
// format:group/interface:version
return invocation.getTargetServiceUniqueName();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use getUrl().getServiceKey()?

* <p>Fix Bug: https://github.com/arextest/arex-agent-java/issues/490
* <p>Notice: This method maybe affect ignore [path] config! Especially when a dubbo service exists multiple versions!
*/
protected String getServiceNameWithVersion(){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method can directly use this.getServiceName(), there is no need to parse it again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dubbo3.0子调用mock结果为null,取不到录制数据
3 participants