You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/01/10 11:51:55 UTC

[skywalking] branch master updated: Stop profiling task when backend doesn't support it (#4213)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 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 1ed179c  Stop profiling task when backend doesn't support it (#4213)
1ed179c is described below

commit 1ed179c0bd7f1b179e83a33c024c2a8c3e1c8f36
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Fri Jan 10 19:51:42 2020 +0800

    Stop profiling task when backend doesn't support it (#4213)
---
 .../apm/agent/core/profile/ProfileTaskQueryService.java    | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ProfileTaskQueryService.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ProfileTaskQueryService.java
index ef7fdb4..5cca040 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ProfileTaskQueryService.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ProfileTaskQueryService.java
@@ -19,6 +19,8 @@
 package org.apache.skywalking.apm.agent.core.profile;
 
 import io.grpc.Channel;
+import io.grpc.Status;
+import io.grpc.StatusRuntimeException;
 import org.apache.skywalking.apm.agent.core.boot.BootService;
 import org.apache.skywalking.apm.agent.core.boot.DefaultImplementor;
 import org.apache.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory;
@@ -73,7 +75,17 @@ public class ProfileTaskQueryService implements BootService, Runnable, GRPCChann
                     Commands commands = profileTaskBlockingStub.withDeadlineAfter(GRPC_UPSTREAM_TIMEOUT, TimeUnit.SECONDS).getProfileTaskCommands(builder.build());
                     ServiceManager.INSTANCE.findService(CommandService.class).receiveCommand(commands);
                 } catch (Throwable t) {
-                    logger.error(t, "query profile task from Collector fail.", t);
+                    if (!(t instanceof StatusRuntimeException)) {
+                        logger.error(t, "query profile task from Collector fail.", t);
+                        return;
+                    }
+                    final StatusRuntimeException statusRuntimeException = (StatusRuntimeException) t;
+                    if (statusRuntimeException.getStatus().getCode() == Status.Code.UNIMPLEMENTED) {
+                        logger.warn("Backend doesn't support profiling, profiling will be disabled");
+                        if (getTaskListFuture != null) {
+                            getTaskListFuture.cancel(true);
+                        }
+                    }
                 }
             }
         }