未验证 提交 1ed179c0 编写于 作者: K kezhenxu94 提交者: GitHub

Stop profiling task when backend doesn't support it (#4213)

上级 42e697af
......@@ -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);
}
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册