From daceca28eef61ba08f99e18b1ba23789b9f62db2 Mon Sep 17 00:00:00 2001 From: carlvine500 Date: Fri, 13 Apr 2018 08:57:06 +0800 Subject: [PATCH] add doc for TraceCrossThread (#1067) * add doc for TraceCrossThread --- docs/README.md | 1 + docs/README_ZH.md | 3 +- ...plication-toolkit-trace-cross-thread-CN.md | 38 +++++++++++++++++++ .../Application-toolkit-trace-cross-thread.md | 36 ++++++++++++++++++ 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 docs/cn/Application-toolkit-trace-cross-thread-CN.md create mode 100644 docs/en/Application-toolkit-trace-cross-thread.md diff --git a/docs/README.md b/docs/README.md index 05001275ee..7996d32452 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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/) diff --git a/docs/README_ZH.md b/docs/README_ZH.md index f8c09690c6..52522cbdbc 100644 --- a/docs/README_ZH.md +++ b/docs/README_ZH.md @@ -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) \ No newline at end of file + * [Kafka消息消费端链路断裂](cn/FAQ/Kafka-plugin-CN.md) diff --git a/docs/cn/Application-toolkit-trace-cross-thread-CN.md b/docs/cn/Application-toolkit-trace-cross-thread-CN.md new file mode 100644 index 0000000000..513c3d82b7 --- /dev/null +++ b/docs/cn/Application-toolkit-trace-cross-thread-CN.md @@ -0,0 +1,38 @@ +# 跨线程追踪 +* 使用 maven 和 gradle 依赖相应的工具包 +```xml + + org.apache.skywalking + apm-toolkit-trace + ${skywalking.version} + +``` + +* 使用方式一. +```java + @TraceCrossThread + public static class MyCallable implements Callable { + @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() { + @Override public String call() throws Exception { + return null; + } + })); +``` +_示例代码,仅供参考_ + + + + + diff --git a/docs/en/Application-toolkit-trace-cross-thread.md b/docs/en/Application-toolkit-trace-cross-thread.md new file mode 100644 index 0000000000..308cb83c9a --- /dev/null +++ b/docs/en/Application-toolkit-trace-cross-thread.md @@ -0,0 +1,36 @@ +# trace cross thread +* Dependency the toolkit, such as using maven or gradle +```xml + + org.apache.skywalking + apm-toolkit-trace + ${skywalking.version} + +``` + +* usage 1. +```java + @TraceCrossThread + public static class MyCallable implements Callable { + @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() { + @Override public String call() throws Exception { + return null; + } + })); +``` +_Sample codes only_ + + + -- GitLab