This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 00e8f2d Fix bug that the agent heart beats too frequently (#4640)
00e8f2d is described below
commit 00e8f2d88698a56b17023150b4e490d7d2376ee8
Author: kezhenxu94 <[email protected]>
AuthorDate: Sun Apr 12 20:48:44 2020 +0800
Fix bug that the agent heart beats too frequently (#4640)
* Fix bug that the agent heart beats too frequently
Co-authored-by: 吴晟 Wu Sheng <[email protected]>
---
.../org/apache/skywalking/apm/agent/core/conf/Config.java | 4 ++--
.../apm/agent/core/remote/ServiceManagementClient.java | 12 ++++++------
docs/en/setup/service-agent/java-agent/README.md | 4 ++--
test/plugin/containers/jvm-container/docker/run.sh | 2 +-
test/plugin/containers/tomcat-container/docker/catalina.sh | 2 +-
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
index 43f7c22..764e514 100755
---
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
+++
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
@@ -117,9 +117,9 @@ public class Config {
*/
public static long GRPC_CHANNEL_CHECK_INTERVAL = 30;
/**
- * service and endpoint registry check interval
+ * The period in which the agent report a heartbeat to the backend.
*/
- public static long APP_AND_SERVICE_REGISTER_CHECK_INTERVAL = 3;
+ public static long HEARTBEAT_PERIOD = 30;
/**
* Collector skywalking trace receiver service addresses.
*/
diff --git
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceManagementClient.java
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceManagementClient.java
index 5211efe..39116ea 100755
---
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceManagementClient.java
+++
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceManagementClient.java
@@ -51,7 +51,7 @@ public class ServiceManagementClient implements BootService,
Runnable, GRPCChann
private volatile GRPCChannelStatus status = GRPCChannelStatus.DISCONNECT;
private volatile ManagementServiceGrpc.ManagementServiceBlockingStub
managementServiceBlockingStub;
- private volatile ScheduledFuture<?> serviceRegisterFuture;
+ private volatile ScheduledFuture<?> heartbeatFuture;
private volatile boolean instancePropertiesSubmitted = false;
@Override
@@ -85,13 +85,13 @@ public class ServiceManagementClient implements
BootService, Runnable, GRPCChann
@Override
public void boot() {
- serviceRegisterFuture = Executors.newSingleThreadScheduledExecutor(
- new DefaultNamedThreadFactory("ServiceRegisterClient")
+ heartbeatFuture = Executors.newSingleThreadScheduledExecutor(
+ new DefaultNamedThreadFactory("ServiceManagementClient")
).scheduleAtFixedRate(
new RunnableWithExceptionProtection(
this,
t -> logger.error("unexpected exception.", t)
- ), 0, Config.Collector.APP_AND_SERVICE_REGISTER_CHECK_INTERVAL,
+ ), 0, Config.Collector.HEARTBEAT_PERIOD,
TimeUnit.SECONDS
);
}
@@ -102,14 +102,14 @@ public class ServiceManagementClient implements
BootService, Runnable, GRPCChann
@Override
public void shutdown() {
- serviceRegisterFuture.cancel(true);
+ heartbeatFuture.cancel(true);
}
@Override
public void run() {
logger.debug("ServiceManagementClient running, status:{}.", status);
- while (GRPCChannelStatus.CONNECTED.equals(status)) {
+ if (GRPCChannelStatus.CONNECTED.equals(status)) {
try {
if (managementServiceBlockingStub != null) {
if (!instancePropertiesSubmitted) {
diff --git a/docs/en/setup/service-agent/java-agent/README.md
b/docs/en/setup/service-agent/java-agent/README.md
index bcb16df..6bd38d9 100755
--- a/docs/en/setup/service-agent/java-agent/README.md
+++ b/docs/en/setup/service-agent/java-agent/README.md
@@ -85,7 +85,7 @@ property key | Description | Default |
`agent.operation_name_threshold `|The operationName max length, setting this
value > 190 is not recommended.|`150`|
`agent.keep_tracing`|Keep tracing even the backend is not available if this
value is `true`.|`false`|
`collector.grpc_channel_check_interval`|grpc channel status check
interval.|`30`|
-`collector.app_and_service_register_check_interval`|application and service
registry check interval.|`3`|
+`collector.heartbeat_period`|agent heartbeat report period. Unit, second.|`30`|
`collector.backend_service`|Collector SkyWalking trace receiver service
addresses.|`127.0.0.1:11800`|
`collector.grpc_upstream_timeout`|How long grpc client will timeout in sending
data to upstream. Unit is second.|`30` seconds|
`collector.get_profile_task_interval`|Sniffer get profile task list
interval.|`20`|
@@ -176,4 +176,4 @@ If you are interested in plugin compatible tests or agent
performance, see the f
# Notice
¹ Due to gRPC didn't support JDK 1.6 since 2018, SkyWalking abandoned the JDK
6/7 supports in all 7.x releases.
-But, with gRPC back forward compatibility(at least for now), all SkyWalking
6.x agents could work with 7.x, including the agent and backend.
\ No newline at end of file
+But, with gRPC back forward compatibility(at least for now), all SkyWalking
6.x agents could work with 7.x, including the agent and backend.
diff --git a/test/plugin/containers/jvm-container/docker/run.sh
b/test/plugin/containers/jvm-container/docker/run.sh
index c7a4af8..d66d8d5 100644
--- a/test/plugin/containers/jvm-container/docker/run.sh
+++ b/test/plugin/containers/jvm-container/docker/run.sh
@@ -64,7 +64,7 @@ healthCheck http://localhost:12800/receiveData
# start applications
export agent_opts="-javaagent:${SCENARIO_HOME}/agent/skywalking-agent.jar
-Dskywalking.collector.grpc_channel_check_interval=2
- -Dskywalking.collector.app_and_service_register_check_interval=2
+ -Dskywalking.collector.heartbeat_period=2
-Dskywalking.collector.discovery_check_interval=2
-Dskywalking.collector.backend_service=localhost:19876
-Dskywalking.agent.service_name=${SCENARIO_NAME}
diff --git a/test/plugin/containers/tomcat-container/docker/catalina.sh
b/test/plugin/containers/tomcat-container/docker/catalina.sh
index e82ac52..f6a3ebe 100644
--- a/test/plugin/containers/tomcat-container/docker/catalina.sh
+++ b/test/plugin/containers/tomcat-container/docker/catalina.sh
@@ -109,7 +109,7 @@ echo "${AGENT_FILE_PATH}/skywalking-agent.jar"
if [ -f "${AGENT_FILE_PATH}/skywalking-agent.jar" ]; then
CATALINA_OPTS="$CATALINA_OPTS
-javaagent:${AGENT_FILE_PATH}/skywalking-agent.jar
-Dskywalking.collector.grpc_channel_check_interval=2
- -Dskywalking.collector.app_and_service_register_check_interval=2
+ -Dskywalking.collector.heartbeat_period=2
-Dskywalking.collector.discovery_check_interval=2
-Dskywalking.collector.backend_service=localhost:19876
-Dskywalking.agent.service_name=${SCENARIO_NAME}