Skip to content

Commit

Permalink
优化服务可见性插件
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbingleixue committed Sep 20, 2023
1 parent 9bb2b8e commit 240d958
Show file tree
Hide file tree
Showing 33 changed files with 145 additions and 320 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ agent.config.serviceInjectList=com.huawei.discovery.service.lb.filter.NopInstanc
agent.service.heartbeat.enable=false
agent.service.gateway.enable=false
agent.service.tracing.enable=false
agent.service.visibility.enable=false
agent.service.inject.enable=true
agent.service.dynamic.config.enable=true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ agent.config.serviceInjectList=com.huawei.discovery.service.lb.filter.NopInstanc
agent.service.heartbeat.enable=true
agent.service.gateway.enable=true
agent.service.tracing.enable=true
agent.service.visibility.enable=true
agent.service.inject.enable=true
agent.service.dynamic.config.enable=true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ public class ServiceConfig implements BaseConfig {
@ConfigFieldKey("tracing.enable")
private boolean tracingEnable = false;

@ConfigFieldKey("visibility.enable")
private boolean visibilityEnable = false;

@ConfigFieldKey("inject.enable")
private boolean injectEnable = false;

Expand Down Expand Up @@ -70,14 +67,6 @@ public void setTracingEnable(boolean tracingEnable) {
this.tracingEnable = tracingEnable;
}

public boolean isVisibilityEnable() {
return visibilityEnable;
}

public void setVisibilityEnable(boolean visibilityEnable) {
this.visibilityEnable = visibilityEnable;
}

public boolean isInjectEnable() {
return injectEnable;
}
Expand Down Expand Up @@ -113,9 +102,6 @@ public boolean checkServiceEnable(String serviceName) {
if (ServiceManager.TRACING_SERVICE_IMPL.equals(serviceName)) {
return isTracingEnable();
}
if (ServiceManager.VISIBILITY_SERVICE_IMPL.equals(serviceName)) {
return isVisibilityEnable();
}
if (ServiceManager.INJECT_SERVICE_IMPL.equals(serviceName)) {
return isInjectEnable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ public class ServiceManager {
public static final String TRACING_SERVICE_IMPL =
"com.huaweicloud.sermant.implement.service.tracing.TracingServiceImpl";

/**
* 服务可见性服务类名
*/
public static final String VISIBILITY_SERVICE_IMPL =
"com.huaweicloud.sermant.implement.service.visibility.VisibilityServiceImpl";

/**
* 日志
*/
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
import com.huaweicloud.sermant.core.notification.NettyNotificationType;
import com.huaweicloud.sermant.core.notification.NotificationInfo;
import com.huaweicloud.sermant.core.notification.NotificationManager;
import com.huaweicloud.sermant.core.service.ServiceConfig;
import com.huaweicloud.sermant.core.service.ServiceManager;
import com.huaweicloud.sermant.core.service.send.config.GatewayConfig;
import com.huaweicloud.sermant.core.service.visibility.api.VisibilityService;
import com.huaweicloud.sermant.core.utils.ThreadFactoryUtils;
import com.huaweicloud.sermant.implement.service.send.netty.pojo.Message;
import com.huaweicloud.sermant.implement.utils.GzipUtils;
Expand Down Expand Up @@ -106,8 +103,6 @@ public class NettyClient {

private ScheduledExecutorService executorService;

private VisibilityService visibilityService;

private boolean connectionAvailable = false;

private int reconnectInternalTime;
Expand Down Expand Up @@ -197,12 +192,6 @@ public synchronized void doConnect() {
NotificationManager.doNotify(new NotificationInfo(NettyNotificationType.CONNECTED, null));
}
}
if (ConfigManager.getConfig(ServiceConfig.class).isVisibilityEnable()) {
if (visibilityService == null) {
visibilityService = ServiceManager.getService(VisibilityService.class);
}
visibilityService.reconnectHandler();
}
} else {
// 判断之前是否已链接 防止链接失败一直发通知,只有链接断开或者首次链接失败才发通知。
if ((isConnected == null || isConnected) && NotificationManager.isEnable()) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
com.huaweicloud.sermant.implement.service.visibility.VisibilityServiceImpl
com.huaweicloud.sermant.implement.service.heartbeat.HeartbeatServiceImpl
com.huaweicloud.sermant.implement.service.send.netty.NettyGatewayClient
com.huaweicloud.sermant.implement.service.dynamicconfig.BufferedDynamicConfigService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*
*/

package com.huaweicloud.sermant.core.service.visibility.common;
package com.huaweicloud.visibility.common;

import com.huaweicloud.sermant.core.service.visibility.entity.BaseInfo;
import com.huaweicloud.sermant.core.service.visibility.entity.Consanguinity;
import com.huaweicloud.sermant.core.service.visibility.entity.Contract;
import com.huaweicloud.visibility.entity.BaseInfo;
import com.huaweicloud.visibility.entity.Consanguinity;
import com.huaweicloud.visibility.entity.Contract;

import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -74,7 +74,7 @@ public static void saveContractInfo(Contract contract) {
*/
public static void saveConsanguinity(Consanguinity consanguinity) {
if (CONSANGUINITY_MAP.containsKey(consanguinity.getServiceKey())) {
Consanguinity consanguinityOld = CONSANGUINITY_MAP.get(consanguinity.getInterfaceName());
Consanguinity consanguinityOld = CONSANGUINITY_MAP.get(consanguinity.getServiceKey());
consanguinityOld.setProviders(consanguinity.getProviders());
} else {
CONSANGUINITY_MAP.putIfAbsent(consanguinity.getServiceKey(), consanguinity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package com.huaweicloud.sermant.core.service.visibility.common;
package com.huaweicloud.visibility.common;

/**
* 操作类型
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package com.huaweicloud.sermant.core.service.visibility.common;
package com.huaweicloud.visibility.common;

/**
* 服务的框架类型
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ApacheDubboRegistryDeclarer extends AbstractCollectorDeclarer {

@Override
public ClassMatcher getClassMatcher() {
return ClassMatcher.nameEquals(ENHANCE_CLASS);
return ClassMatcher.isExtendedFrom(ENHANCE_CLASS);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package com.huaweicloud.sermant.core.service.visibility.entity;
package com.huaweicloud.visibility.entity;

/**
* 服务可见性基础信息
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package com.huaweicloud.sermant.core.service.visibility.entity;
package com.huaweicloud.visibility.entity;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package com.huaweicloud.sermant.core.service.visibility.entity;
package com.huaweicloud.visibility.entity;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package com.huaweicloud.sermant.core.service.visibility.entity;
package com.huaweicloud.visibility.entity;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package com.huaweicloud.sermant.core.service.visibility.entity;
package com.huaweicloud.visibility.entity;

/**
* 参数信息
Expand Down
Loading

0 comments on commit 240d958

Please sign in to comment.