You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/03/23 12:27:55 UTC

[GitHub] [skywalking] wu-sheng commented on a change in pull request #4555: Correlation protocol implement

wu-sheng commented on a change in pull request #4555: Correlation protocol implement
URL: https://github.com/apache/skywalking/pull/4555#discussion_r396327981
 
 

 ##########
 File path: docs/en/setup/service-agent/java-agent/Application-toolkit-correlation.md
 ##########
 @@ -0,0 +1,33 @@
+## Cross Process Correlation
+
+## Introduce
+This plugin is help user to transport custom data in the tracing context. [Follow this to get protocol description.](../../../protocols/Skywalking-Cross-Process-Correlation-Headers-Protocol-v1.md)
+
+## How to use it
+* 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>
+```
+
+* Use `CorrelationContext.set()` API to setting custom data.
+```java
+CorrelationSettingResult settingResult = CorrelationContext.set("customKey", "customValue");
+```
+_Sample codes only_
+
+1. Add `CorrelationContext.set` to setting your custom data.
+1. Key and value only support `String` type.
+1. Please follow [the agent configuration](README.md#table-of-agent-configuration-properties) to get more setting limit.
+
+* Use `CorrelationContext.get()` API to get custom data.
+```java
+CorrelationContext.get("customKey");
+```
+_Sample codes only_
+
+1. `CorrelationContext.get` to get custom data.
+1. Return empty string if cannot found the custom key.
 
 Review comment:
   I think in the JDK 1.8, the recommended way is returning `option`. We can't have that because agent used to be JDK1.6 compatible, but we are not anymore. The new API should follow the JDK1.8 sytle.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services