parent
8612f80260
commit
daceca28ee
|
|
@ -21,6 +21,7 @@
|
|||
* [log4j2](en/Application-toolkit-log4j-2.x.md)
|
||||
* [logback](en/Application-toolkit-logback-1.x.md)
|
||||
* [Trace](en/Application-toolkit-trace.md)
|
||||
* [Propagate Context across Thread](en/Application-toolkit-trace-cross-thread.md)
|
||||
* Testing
|
||||
* [Plugin Test](https://github.com/SkywalkingTest/agent-integration-test-report)
|
||||
* [Java Agent Performance Test](https://skywalkingtest.github.io/Agent-Benchmarks/)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* [log4j2组件](cn/Application-toolkit-log4j-2.x-CN.md)
|
||||
* [logback组件](cn/Application-toolkit-logback-1.x-CN.md)
|
||||
* [Trace](cn/Application-toolkit-trace-CN.md)
|
||||
* [调用链跨线程传递](cn/Application-toolkit-trace-cross-thread-CN.md)
|
||||
* 测试用例
|
||||
* [插件测试](https://github.com/SkywalkingTest/agent-integration-test-report)
|
||||
* [Java 探针性能测试](https://skywalkingtest.github.io/Agent-Benchmarks/README_zh.html)
|
||||
|
|
@ -38,4 +39,4 @@
|
|||
* FAQ
|
||||
* [Trace查询有数据,但是没有拓扑图和JVM数据?](cn/FAQ/Why-have-traces-no-others-CN.md)
|
||||
* [加载探针,Console被GRPC日志刷屏](cn/FAQ/Too-many-gRPC-logs-CN.md)
|
||||
* [Kafka消息消费端链路断裂](cn/FAQ/Kafka-plugin-CN.md)
|
||||
* [Kafka消息消费端链路断裂](cn/FAQ/Kafka-plugin-CN.md)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
# 跨线程追踪
|
||||
* 使用 maven 和 gradle 依赖相应的工具包
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>apm-toolkit-trace</artifactId>
|
||||
<version>${skywalking.version}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
* 使用方式一.
|
||||
```java
|
||||
@TraceCrossThread
|
||||
public static class MyCallable<String> implements Callable<String> {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
...
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(1);
|
||||
executorService.submit(new MyCallable());
|
||||
```
|
||||
* 使用方式二.
|
||||
```java
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(1);
|
||||
executorService.submit(CallableWrapper.of(new Callable<String>() {
|
||||
@Override public String call() throws Exception {
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
```
|
||||
_示例代码,仅供参考_
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
# trace cross thread
|
||||
* Dependency the toolkit, such as using maven or gradle
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>apm-toolkit-trace</artifactId>
|
||||
<version>${skywalking.version}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
* usage 1.
|
||||
```java
|
||||
@TraceCrossThread
|
||||
public static class MyCallable<String> implements Callable<String> {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
...
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(1);
|
||||
executorService.submit(new MyCallable());
|
||||
```
|
||||
* usage 2.
|
||||
```java
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(1);
|
||||
executorService.submit(CallableWrapper.of(new Callable<String>() {
|
||||
@Override public String call() throws Exception {
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
```
|
||||
_Sample codes only_
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue