diff --git a/sermant-agentcore/sermant-agentcore-config/config/config.properties b/sermant-agentcore/sermant-agentcore-config/config/config.properties index 5b1f0cc438..f8e889e300 100644 --- a/sermant-agentcore/sermant-agentcore-config/config/config.properties +++ b/sermant-agentcore/sermant-agentcore-config/config/config.properties @@ -3,15 +3,23 @@ agent.config.isEnhanceBootStrapEnable=false agent.config.ignoredPrefixes=com.huawei.sermant,com.huaweicloud.sermant agent.config.ignoredInterfaces=org.springframework.cglib.proxy.Factory agent.config.combineStrategy=ALL -agent.config.serviceBlackList=com.huaweicloud.sermant.implement.service.heartbeat.HeartbeatServiceImpl,com.huaweicloud.sermant.implement.service.send.netty.NettyGatewayClient,com.huaweicloud.sermant.implement.service.tracing.TracingServiceImpl agent.config.serviceInjectList=com.huawei.discovery.service.lb.filter.NopInstanceFilter,com.huawei.discovery.service.lb.DiscoveryManager,com.huawei.discovery.service.util.ApplyUtil,com.huawei.discovery.service.lb.cache.InstanceCacheManager +# agent service config +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.monitor.enable=false +agent.service.dynamic.config.enable=true + # event config -event.config.enable=false -event.config.offerWarnLog=false -event.config.offerErrorLog=false -event.config.sendInterval=30000 -event.config.offerInterval=300000 +event.enable=false +event.offerWarnLog=false +event.offerErrorLog=false +event.sendInterval=30000 +event.offerInterval=300000 # dynamic config dynamic.config.timeoutValue=30000 @@ -28,18 +36,13 @@ dynamic.config.enableAuth=false # heartbeat config heartbeat.interval=30000 -#backend config -backend.nettyIp=127.0.0.1 -backend.nettyPort=6888 -backend.httpIp=127.0.0.1 -backend.httpPort=8900 +# gateway config +gateway.nettyIp=127.0.0.1 +gateway.nettyPort=6888 # service meta config service.meta.application=default service.meta.version=1.0.0 service.meta.project=default service.meta.environment= -service.meta.zone= - -# service visibility config -visibility.service.enableStart=false \ No newline at end of file +service.meta.zone= \ No newline at end of file diff --git a/sermant-agentcore/sermant-agentcore-config/config/test/config.properties b/sermant-agentcore/sermant-agentcore-config/config/test/config.properties index 77cece5595..7f498d9e0f 100644 --- a/sermant-agentcore/sermant-agentcore-config/config/test/config.properties +++ b/sermant-agentcore/sermant-agentcore-config/config/test/config.properties @@ -3,15 +3,23 @@ agent.config.isEnhanceBootStrapEnable=false agent.config.ignoredPrefixes=com.huawei.sermant,com.huaweicloud.sermant agent.config.ignoredInterfaces=org.springframework.cglib.proxy.Factory agent.config.combineStrategy=ALL -agent.config.serviceBlackList=com.huaweicloud.sermant.implement.service.heartbeat.HeartbeatServiceImpl,com.huaweicloud.sermant.implement.service.send.netty.NettyGatewayClient,com.huaweicloud.sermant.implement.service.tracing.TracingServiceImpl -agent.config.serviceInjectList=com.huawei.discovery.service.lb.filter.NopInstanceFilter,com.huawei.discovery.service.lb.DiscoveryManager +agent.config.serviceInjectList=com.huawei.discovery.service.lb.filter.NopInstanceFilter,com.huawei.discovery.service.lb.DiscoveryManager,com.huawei.discovery.service.util.ApplyUtil,com.huawei.discovery.service.lb.cache.InstanceCacheManager + +# agent service config +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.monitor.enable=true +agent.service.dynamic.config.enable=true # event config -event.config.enable=false -event.config.offerWarnLog=false -event.config.offerErrorLog=false -event.config.sendInterval=30000 -event.config.offerInterval=300000 +event.enable=false +event.offerWarnLog=false +event.offerErrorLog=false +event.sendInterval=30000 +event.offerInterval=300000 # dynamic config dynamic.config.timeoutValue=30000 @@ -28,15 +36,13 @@ dynamic.config.enableAuth=false # heartbeat config heartbeat.interval=30000 -#backend config -backend.nettyIp=127.0.0.1 -backend.nettyPort=6888 -backend.httpIp=127.0.0.1 -backend.httpPort=8900 +# gateway config +gateway.nettyIp=127.0.0.1 +gateway.nettyPort=6888 # service meta config service.meta.application=default service.meta.version=1.0.0 service.meta.project=default service.meta.environment= -service.meta.zone= +service.meta.zone= \ No newline at end of file diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/event/config/EventConfig.java b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/event/config/EventConfig.java index a94d0ee89e..bdedc1874a 100644 --- a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/event/config/EventConfig.java +++ b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/event/config/EventConfig.java @@ -25,7 +25,7 @@ * @author luanwenfei * @since 2023-03-08 */ -@ConfigTypeKey("event.config") +@ConfigTypeKey("event") public class EventConfig implements BaseConfig { /** * 默认事件发送时间间隔 diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/plugin/agent/config/AgentConfig.java b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/plugin/agent/config/AgentConfig.java index f219075f9d..0037e893fb 100644 --- a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/plugin/agent/config/AgentConfig.java +++ b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/plugin/agent/config/AgentConfig.java @@ -63,11 +63,6 @@ public class AgentConfig implements BaseConfig { */ private CombineStrategy combineStrategy = CombineStrategy.ALL; - /** - * agent服务黑名单 - */ - private Set serviceBlackList = Collections.emptySet(); - /** * 拦截插件服务名单 */ @@ -113,14 +108,6 @@ public void setEnhancedClassOutputPath(String enhancedClassOutputPath) { this.enhancedClassOutputPath = enhancedClassOutputPath; } - public Set getServiceBlackList() { - return serviceBlackList; - } - - public void setServiceBlackList(Set serviceBlackList) { - this.serviceBlackList = serviceBlackList; - } - public Set getServiceInjectList() { return serviceInjectList; } diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/ServiceConfig.java b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/ServiceConfig.java new file mode 100644 index 0000000000..872779d4a1 --- /dev/null +++ b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/ServiceConfig.java @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.huaweicloud.sermant.core.service; + +import com.huaweicloud.sermant.core.config.common.BaseConfig; +import com.huaweicloud.sermant.core.config.common.ConfigFieldKey; +import com.huaweicloud.sermant.core.config.common.ConfigTypeKey; + +/** + * Agent核心服务的通用配置 + * + * @author luanwenfei + * @since 2023-04-01 + */ +@ConfigTypeKey("agent.service") +public class ServiceConfig implements BaseConfig { + @ConfigFieldKey("heartbeat.enable") + private boolean heartBeatEnable = false; + + @ConfigFieldKey("gateway.enable") + private boolean gatewayEnable = false; + + @ConfigFieldKey("tracing.enable") + private boolean tracingEnable = false; + + @ConfigFieldKey("visibility.enable") + private boolean visibilityEnable = false; + + @ConfigFieldKey("inject.enable") + private boolean injectEnable = false; + + @ConfigFieldKey("monitor.enable") + private boolean monitorEnable = false; + + @ConfigFieldKey("dynamic.config.enable") + private boolean dynamicConfigEnable = false; + + public boolean isHeartBeatEnable() { + return heartBeatEnable; + } + + public void setHeartBeatEnable(boolean heartBeatEnable) { + this.heartBeatEnable = heartBeatEnable; + } + + public boolean isGatewayEnable() { + return gatewayEnable; + } + + public void setGatewayEnable(boolean gatewayEnable) { + this.gatewayEnable = gatewayEnable; + } + + public boolean isTracingEnable() { + return tracingEnable; + } + + 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; + } + + public void setInjectEnable(boolean injectEnable) { + this.injectEnable = injectEnable; + } + + public boolean isMonitorEnable() { + return monitorEnable; + } + + public void setMonitorEnable(boolean monitorEnable) { + this.monitorEnable = monitorEnable; + } + + public boolean isDynamicConfigEnable() { + return dynamicConfigEnable; + } + + public void setDynamicConfigEnable(boolean dynamicConfigEnable) { + this.dynamicConfigEnable = dynamicConfigEnable; + } + + /** + * 通过服务的类名来检查该类型服务是否开启 + * + * @param serviceName 服务名 + * @return 是否开启了该服务 + */ + public boolean checkServiceEnable(String serviceName) { + if ("com.huaweicloud.sermant.implement.service.heartbeat.HeartbeatServiceImpl".equals(serviceName)) { + return isHeartBeatEnable(); + } + if ("com.huaweicloud.sermant.implement.service.send.netty.NettyGatewayClient".equals(serviceName)) { + return isGatewayEnable(); + } + if ("com.huaweicloud.sermant.implement.service.dynamicconfig.BufferedDynamicConfigService".equals( + serviceName)) { + return isDynamicConfigEnable(); + } + if ("com.huaweicloud.sermant.implement.service.tracing.TracingServiceImpl".equals(serviceName)) { + return isTracingEnable(); + } + if ("com.huaweicloud.sermant.implement.service.visibility.VisibilityServiceImpl".equals(serviceName)) { + return isVisibilityEnable(); + } + if ("com.huaweicloud.sermant.implement.service.inject.InjectServiceImpl".equals(serviceName)) { + return isInjectEnable(); + } + if ("com.huaweicloud.sermant.implement.service.monitor.RegistryServiceImpl".equals(serviceName)) { + return isMonitorEnable(); + } + return false; + } +} diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/ServiceManager.java b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/ServiceManager.java index 7de18cedf2..63be85ceb7 100644 --- a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/ServiceManager.java +++ b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/ServiceManager.java @@ -28,7 +28,6 @@ import com.huaweicloud.sermant.core.event.EventManager; import com.huaweicloud.sermant.core.event.collector.FrameworkEventCollector; import com.huaweicloud.sermant.core.exception.DupServiceException; -import com.huaweicloud.sermant.core.plugin.agent.config.AgentConfig; import com.huaweicloud.sermant.core.utils.SpiLoadUtils; import java.util.ArrayList; @@ -59,9 +58,9 @@ public class ServiceManager { private static final Map SERVICES = new HashMap(); /** - * agent配置 + * Agent核心服务配置 */ - private static final AgentConfig AGENT_CONFIG = ConfigManager.getConfig(AgentConfig.class); + private static final ServiceConfig SERVICE_CONFIG = ConfigManager.getConfig(ServiceConfig.class); /** * Constructor. @@ -76,8 +75,8 @@ public static void initServices() { ArrayList startServiceArray = new ArrayList<>(); for (final BaseService service : ServiceLoader.load(BaseService.class, ClassLoaderManager.getFrameworkClassLoader())) { - if (!AGENT_CONFIG.getServiceBlackList().contains(service.getClass().getName()) - && loadService(service, service.getClass(), BaseService.class)) { + if (SERVICE_CONFIG.checkServiceEnable(service.getClass().getName()) && loadService(service, + service.getClass(), BaseService.class)) { service.start(); startServiceArray.add(service.getClass().getName()); } diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/send/config/BackendConfig.java b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/send/config/GatewayConfig.java similarity index 73% rename from sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/send/config/BackendConfig.java rename to sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/send/config/GatewayConfig.java index ccb6254852..5aa6c5eb98 100644 --- a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/send/config/BackendConfig.java +++ b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/send/config/GatewayConfig.java @@ -20,21 +20,17 @@ import com.huaweicloud.sermant.core.config.common.ConfigTypeKey; /** - * Backend配置 + * gateway配置 * * @author luanwenfei * @since 2022-03-24 */ -@ConfigTypeKey("backend") -public class BackendConfig implements BaseConfig { +@ConfigTypeKey("gateway") +public class GatewayConfig implements BaseConfig { private String nettyIp; private int nettyPort; - private String httpIp; - - private int httpPort; - public String getNettyIp() { return nettyIp; } @@ -50,20 +46,4 @@ public int getNettyPort() { public void setNettyPort(int nettyPort) { this.nettyPort = nettyPort; } - - public String getHttpIp() { - return httpIp; - } - - public void setHttpIp(String httpIp) { - this.httpIp = httpIp; - } - - public int getHttpPort() { - return httpPort; - } - - public void setHttpPort(int httpPort) { - this.httpPort = httpPort; - } } diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/visibility/config/VisibilityServiceConfig.java b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/visibility/config/VisibilityServiceConfig.java deleted file mode 100644 index 7e346789a9..0000000000 --- a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/service/visibility/config/VisibilityServiceConfig.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.huaweicloud.sermant.core.service.visibility.config; - -import com.huaweicloud.sermant.core.config.common.BaseConfig; -import com.huaweicloud.sermant.core.config.common.ConfigTypeKey; - -/** - * 配置信息 - * - * @author zhp - * @since 2022-12-05 - */ -@ConfigTypeKey("visibility.service") -public class VisibilityServiceConfig implements BaseConfig { - - private boolean enableStart; - - public boolean isEnableStart() { - return enableStart; - } - - public void setEnableStart(boolean enableStart) { - this.enableStart = enableStart; - } -} diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.config.common.BaseConfig b/sermant-agentcore/sermant-agentcore-core/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.config.common.BaseConfig index c7db221210..c8f5548d3b 100644 --- a/sermant-agentcore/sermant-agentcore-core/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.config.common.BaseConfig +++ b/sermant-agentcore/sermant-agentcore-core/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.config.common.BaseConfig @@ -1,8 +1,8 @@ com.huaweicloud.sermant.core.plugin.agent.config.AgentConfig +com.huaweicloud.sermant.core.service.ServiceConfig com.huaweicloud.sermant.core.event.config.EventConfig com.huaweicloud.sermant.core.service.dynamicconfig.config.DynamicConfig com.huaweicloud.sermant.core.service.dynamicconfig.config.KieDynamicConfig com.huaweicloud.sermant.core.service.heartbeat.config.HeartbeatConfig +com.huaweicloud.sermant.core.service.send.config.GatewayConfig com.huaweicloud.sermant.core.plugin.config.ServiceMeta -com.huaweicloud.sermant.core.service.send.config.BackendConfig -com.huaweicloud.sermant.core.service.visibility.config.VisibilityServiceConfig diff --git a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyClient.java b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyClient.java index ac41bc254b..0b7810752e 100644 --- a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyClient.java +++ b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyClient.java @@ -17,6 +17,8 @@ package com.huaweicloud.sermant.implement.service.send.netty; import com.huaweicloud.sermant.core.common.LoggerFactory; +import com.huaweicloud.sermant.core.config.ConfigManager; +import com.huaweicloud.sermant.core.service.ServiceConfig; import com.huaweicloud.sermant.core.service.ServiceManager; import com.huaweicloud.sermant.core.service.visibility.api.VisibilityService; import com.huaweicloud.sermant.core.utils.ThreadFactoryUtils; @@ -89,7 +91,7 @@ public class NettyClient { private ScheduledExecutorService executorService; - private final VisibilityService service = ServiceManager.getService(VisibilityService.class); + private VisibilityService visibilityService; private boolean connectionAvailable = false; @@ -161,7 +163,12 @@ public synchronized void doConnect() { executorService = Executors.newScheduledThreadPool(1, new ThreadFactoryUtils("netty-send-thread")); executorService.scheduleAtFixedRate(sender, 0, sendInterval, TimeUnit.MILLISECONDS); } - service.reconnectHandler(); + if (ConfigManager.getConfig(ServiceConfig.class).isVisibilityEnable()) { + if (visibilityService == null) { + visibilityService = ServiceManager.getService(VisibilityService.class); + } + visibilityService.reconnectHandler(); + } } else { // 失败则在X秒后重试连接 LOGGER.info(String.format(Locale.ROOT, "Failed to connect,try reconnecting after %s seconds ", diff --git a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyClientFactory.java b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyClientFactory.java index 1cc0973aa3..161d61a5d4 100644 --- a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyClientFactory.java +++ b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyClientFactory.java @@ -17,7 +17,7 @@ package com.huaweicloud.sermant.implement.service.send.netty; import com.huaweicloud.sermant.core.config.ConfigManager; -import com.huaweicloud.sermant.core.service.send.config.BackendConfig; +import com.huaweicloud.sermant.core.service.send.config.GatewayConfig; import java.util.HashMap; import java.util.Map; @@ -48,8 +48,8 @@ private static void refreshClientMap(String address, NettyClient client) { * @return NettyClient */ public synchronized NettyClient getDefaultNettyClient() { - BackendConfig backendConfig = ConfigManager.getConfig(BackendConfig.class); - return getNettyClient(backendConfig.getNettyIp(), backendConfig.getNettyPort()); + GatewayConfig gatewayConfig = ConfigManager.getConfig(GatewayConfig.class); + return getNettyClient(gatewayConfig.getNettyIp(), gatewayConfig.getNettyPort()); } /** diff --git a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyGatewayClient.java b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyGatewayClient.java index c048a5c144..6dfe4d8108 100644 --- a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyGatewayClient.java +++ b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/send/netty/NettyGatewayClient.java @@ -19,7 +19,7 @@ import com.huaweicloud.sermant.core.common.LoggerFactory; import com.huaweicloud.sermant.core.config.ConfigManager; import com.huaweicloud.sermant.core.service.send.api.GatewayClient; -import com.huaweicloud.sermant.core.service.send.config.BackendConfig; +import com.huaweicloud.sermant.core.service.send.config.GatewayConfig; import com.huaweicloud.sermant.implement.service.send.netty.pojo.Message; import com.alibaba.fastjson.JSON; @@ -41,9 +41,9 @@ public class NettyGatewayClient implements GatewayClient { @Override public void start() { - BackendConfig backendConfig = ConfigManager.getConfig(BackendConfig.class); + GatewayConfig gatewayConfig = ConfigManager.getConfig(GatewayConfig.class); nettyClient = NettyClientFactory.getInstance() - .getNettyClient(backendConfig.getNettyIp(), backendConfig.getNettyPort()); + .getNettyClient(gatewayConfig.getNettyIp(), gatewayConfig.getNettyPort()); } @Override diff --git a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/visibility/VisibilityServiceImpl.java b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/visibility/VisibilityServiceImpl.java index e0c3b44487..7563a70723 100644 --- a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/visibility/VisibilityServiceImpl.java +++ b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/service/visibility/VisibilityServiceImpl.java @@ -21,12 +21,12 @@ import com.huaweicloud.sermant.core.common.LoggerFactory; import com.huaweicloud.sermant.core.config.ConfigManager; import com.huaweicloud.sermant.core.plugin.config.ServiceMeta; +import com.huaweicloud.sermant.core.service.ServiceConfig; import com.huaweicloud.sermant.core.service.ServiceManager; import com.huaweicloud.sermant.core.service.send.api.GatewayClient; import com.huaweicloud.sermant.core.service.visibility.api.VisibilityService; import com.huaweicloud.sermant.core.service.visibility.common.CollectorCache; import com.huaweicloud.sermant.core.service.visibility.common.OperateType; -import com.huaweicloud.sermant.core.service.visibility.config.VisibilityServiceConfig; import com.huaweicloud.sermant.core.service.visibility.entity.ServerInfo; import com.huaweicloud.sermant.implement.service.send.netty.pojo.Message; @@ -45,7 +45,7 @@ public class VisibilityServiceImpl implements VisibilityService { private static final Logger LOGGER = LoggerFactory.getLogger(); - private final VisibilityServiceConfig config = ConfigManager.getConfig(VisibilityServiceConfig.class); + private final ServiceConfig serviceConfig = ConfigManager.getConfig(ServiceConfig.class); private final ServiceMeta serviceMeta = ConfigManager.getConfig(ServiceMeta.class); @@ -53,7 +53,7 @@ public class VisibilityServiceImpl implements VisibilityService { @Override public void reconnectHandler() { - if (!config.isEnableStart()) { + if (!serviceConfig.isVisibilityEnable()) { return; } initClient(); @@ -72,7 +72,7 @@ public void reconnectHandler() { @Override public void stop() { - if (!config.isEnableStart()) { + if (!serviceConfig.isVisibilityEnable()) { return; } initClient();