add doc for TraceCrossThread (#1067)

* add doc for TraceCrossThread
This commit is contained in:
carlvine500 2018-04-13 08:57:06 +08:00 committed by 吴晟 Wu Sheng
parent 8612f80260
commit daceca28ee
4 changed files with 77 additions and 1 deletions

View File

@ -21,6 +21,7 @@
* [log4j2](en/Application-toolkit-log4j-2.x.md) * [log4j2](en/Application-toolkit-log4j-2.x.md)
* [logback](en/Application-toolkit-logback-1.x.md) * [logback](en/Application-toolkit-logback-1.x.md)
* [Trace](en/Application-toolkit-trace.md) * [Trace](en/Application-toolkit-trace.md)
* [Propagate Context across Thread](en/Application-toolkit-trace-cross-thread.md)
* Testing * Testing
* [Plugin Test](https://github.com/SkywalkingTest/agent-integration-test-report) * [Plugin Test](https://github.com/SkywalkingTest/agent-integration-test-report)
* [Java Agent Performance Test](https://skywalkingtest.github.io/Agent-Benchmarks/) * [Java Agent Performance Test](https://skywalkingtest.github.io/Agent-Benchmarks/)

View File

@ -21,6 +21,7 @@
* [log4j2组件](cn/Application-toolkit-log4j-2.x-CN.md) * [log4j2组件](cn/Application-toolkit-log4j-2.x-CN.md)
* [logback组件](cn/Application-toolkit-logback-1.x-CN.md) * [logback组件](cn/Application-toolkit-logback-1.x-CN.md)
* [Trace](cn/Application-toolkit-trace-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) * [插件测试](https://github.com/SkywalkingTest/agent-integration-test-report)
* [Java 探针性能测试](https://skywalkingtest.github.io/Agent-Benchmarks/README_zh.html) * [Java 探针性能测试](https://skywalkingtest.github.io/Agent-Benchmarks/README_zh.html)

View File

@ -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;
}
}));
```
_示例代码仅供参考_

View File

@ -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_