wu-sheng commented on a change in pull request #209:
URL: https://github.com/apache/skywalking-website/pull/209#discussion_r570921468



##########
File path: content/blog/2021-02-04-skywalking-trace-threadpool/index.md
##########
@@ -0,0 +1,41 @@
+---
+title: "Apache SkyWalking: How to propagate context between threads when using 
ThreadPoolExecutor"
+date: 2021-02-04
+author: "Binglong Li"
+description: "This post introduces how to propagate context between threads 
when using ThreadPoolExecutor, 
+which skywalking agent can not enhance"

Review comment:
       ```suggestion
   which SkyWalking agent should not enhance"
   ```

##########
File path: content/blog/2021-02-04-skywalking-trace-threadpool/index.md
##########
@@ -0,0 +1,41 @@
+---
+title: "Apache SkyWalking: How to propagate context between threads when using 
ThreadPoolExecutor"
+date: 2021-02-04
+author: "Binglong Li"
+description: "This post introduces how to propagate context between threads 
when using ThreadPoolExecutor, 
+which skywalking agent can not enhance"
+tags:
+- Java
+- Agent
+- Tracing
+- thread
+---
+
+When using skywalking java agent, people usually propagate context easily. 
They even do not need to change the business 
+code. However, it becomes harder when you want to propagate context between 
threads when using ThreadPoolExecutor. 
+You can use the RunnableWrapper in the maven artifact 
org.apache.skywalking:apm-toolkit-trace. This way you must change 
+your code. The developer manager usually don't like this because there may be 
lots of projects, or lots of runnable code. 
+If they don't use skywalking some day, the code added will be superfluous and 
inelegant.
+
+Is there a way to propagate context without changing the business code? Yes. 
+
+Skywalking java agent enhances an instance by add a field and implement an 
interface. The ThreadPoolExecutor is a special

Review comment:
       ```suggestion
   Skywalking java agent enhances a class by add a field and implement an 
interface. The ThreadPoolExecutor is a special
   ```

##########
File path: content/blog/2021-02-04-skywalking-trace-threadpool/index.md
##########
@@ -0,0 +1,41 @@
+---
+title: "Apache SkyWalking: How to propagate context between threads when using 
ThreadPoolExecutor"
+date: 2021-02-04
+author: "Binglong Li"
+description: "This post introduces how to propagate context between threads 
when using ThreadPoolExecutor, 
+which skywalking agent can not enhance"
+tags:
+- Java
+- Agent
+- Tracing
+- thread
+---
+
+When using skywalking java agent, people usually propagate context easily. 
They even do not need to change the business 

Review comment:
       All `skywalking` should be `SkyWalking`

##########
File path: content/blog/2021-02-04-skywalking-trace-threadpool/index.md
##########
@@ -0,0 +1,41 @@
+---
+title: "Apache SkyWalking: How to propagate context between threads when using 
ThreadPoolExecutor"
+date: 2021-02-04
+author: "Binglong Li"
+description: "This post introduces how to propagate context between threads 
when using ThreadPoolExecutor, 
+which skywalking agent can not enhance"
+tags:
+- Java
+- Agent
+- Tracing
+- thread
+---
+
+When using skywalking java agent, people usually propagate context easily. 
They even do not need to change the business 
+code. However, it becomes harder when you want to propagate context between 
threads when using ThreadPoolExecutor. 
+You can use the RunnableWrapper in the maven artifact 
org.apache.skywalking:apm-toolkit-trace. This way you must change 
+your code. The developer manager usually don't like this because there may be 
lots of projects, or lots of runnable code. 
+If they don't use skywalking some day, the code added will be superfluous and 
inelegant.
+
+Is there a way to propagate context without changing the business code? Yes. 
+
+Skywalking java agent enhances an instance by add a field and implement an 
interface. The ThreadPoolExecutor is a special
+class that is used widely. We even don't know when and where it is loaded. 
Most JVMs do not allow changes in the class
+file format for classes that have been loaded previously. So skywalking can 
not always enhance the ThreadPoolExecutor 
+properly. However, we can apply advice to the ThreadPoolExecutor#execute 
method and wrap the Runnable param using our 
+own agent, then enhance the wrapper class by skywalking java agent. An advice 
do not change the layout of a class.
+
+Now we should decide how to do this. You can use the RunnableWrapper in the 
maven artifact 
+org.apache.skywalking:apm-toolkit-trace to wrap the param, but you will face 
another problem. This RunnableWrapper 

Review comment:
       ```suggestion
   org.apache.skywalking:apm-toolkit-trace to wrap the param, but you need to 
face another problem. This RunnableWrapper 
   ```

##########
File path: content/blog/2021-02-04-skywalking-trace-threadpool/index.md
##########
@@ -0,0 +1,41 @@
+---
+title: "Apache SkyWalking: How to propagate context between threads when using 
ThreadPoolExecutor"
+date: 2021-02-04
+author: "Binglong Li"
+description: "This post introduces how to propagate context between threads 
when using ThreadPoolExecutor, 
+which skywalking agent can not enhance"
+tags:
+- Java
+- Agent
+- Tracing
+- thread
+---
+
+When using skywalking java agent, people usually propagate context easily. 
They even do not need to change the business 
+code. However, it becomes harder when you want to propagate context between 
threads when using ThreadPoolExecutor. 
+You can use the RunnableWrapper in the maven artifact 
org.apache.skywalking:apm-toolkit-trace. This way you must change 
+your code. The developer manager usually don't like this because there may be 
lots of projects, or lots of runnable code. 
+If they don't use skywalking some day, the code added will be superfluous and 
inelegant.
+
+Is there a way to propagate context without changing the business code? Yes. 
+
+Skywalking java agent enhances an instance by add a field and implement an 
interface. The ThreadPoolExecutor is a special
+class that is used widely. We even don't know when and where it is loaded. 
Most JVMs do not allow changes in the class
+file format for classes that have been loaded previously. So skywalking can 
not always enhance the ThreadPoolExecutor 
+properly. However, we can apply advice to the ThreadPoolExecutor#execute 
method and wrap the Runnable param using our 
+own agent, then enhance the wrapper class by skywalking java agent. An advice 
do not change the layout of a class.
+
+Now we should decide how to do this. You can use the RunnableWrapper in the 
maven artifact 
+org.apache.skywalking:apm-toolkit-trace to wrap the param, but you will face 
another problem. This RunnableWrapper 
+has a plugin whose active condition is checking if there is @TraceCrossThread. 
Byte buddy in
+skywalking will use 
net.bytebuddy.pool.TypePool.Default.WithLazyResolution.LazyTypeDescription to 
find the annotations
+of a class. The LazyTypeDescription finds annotations by using a 
URLClassLoader with no urls if the classloader is
+null(bootstrap classloader). So it can not find the @TraceCrossThread class 
unless you change the LocationStrategy of
+skywalking java agent builder.
+
+In [this project](https://github.com/libinglong/skywalking-threadpool-agent), 
I write my own wrapper class, 
+and simply add a plugin with a name match condition.
+
+Finally, note you should add your own agent after the skywalking agent since 
the wrapper class should not be loaded before
+skywalking agent instrumentation have finished.

Review comment:
       Recommend to share a `java -javaagent:` example here.

##########
File path: content/blog/2021-02-04-skywalking-trace-threadpool/index.md
##########
@@ -0,0 +1,41 @@
+---
+title: "Apache SkyWalking: How to propagate context between threads when using 
ThreadPoolExecutor"
+date: 2021-02-04
+author: "Binglong Li"
+description: "This post introduces how to propagate context between threads 
when using ThreadPoolExecutor, 
+which skywalking agent can not enhance"
+tags:
+- Java
+- Agent
+- Tracing
+- thread

Review comment:
       ```suggestion
   ```

##########
File path: content/blog/2021-02-04-skywalking-trace-threadpool/index.md
##########
@@ -0,0 +1,41 @@
+---
+title: "Apache SkyWalking: How to propagate context between threads when using 
ThreadPoolExecutor"
+date: 2021-02-04
+author: "Binglong Li"
+description: "This post introduces how to propagate context between threads 
when using ThreadPoolExecutor, 
+which skywalking agent can not enhance"
+tags:
+- Java
+- Agent
+- Tracing
+- thread
+---
+
+When using skywalking java agent, people usually propagate context easily. 
They even do not need to change the business 
+code. However, it becomes harder when you want to propagate context between 
threads when using ThreadPoolExecutor. 
+You can use the RunnableWrapper in the maven artifact 
org.apache.skywalking:apm-toolkit-trace. This way you must change 
+your code. The developer manager usually don't like this because there may be 
lots of projects, or lots of runnable code. 
+If they don't use skywalking some day, the code added will be superfluous and 
inelegant.
+
+Is there a way to propagate context without changing the business code? Yes. 
+
+Skywalking java agent enhances an instance by add a field and implement an 
interface. The ThreadPoolExecutor is a special
+class that is used widely. We even don't know when and where it is loaded. 
Most JVMs do not allow changes in the class

Review comment:
       I think this sentence is not correct. Bytebuddy, technically could 
enhance the class, but it is used inside agent core, and we are not sure the 
side-effect due to its widely used. 

##########
File path: content/blog/2021-02-04-skywalking-trace-threadpool/index.md
##########
@@ -0,0 +1,41 @@
+---
+title: "Apache SkyWalking: How to propagate context between threads when using 
ThreadPoolExecutor"
+date: 2021-02-04
+author: "Binglong Li"
+description: "This post introduces how to propagate context between threads 
when using ThreadPoolExecutor, 
+which skywalking agent can not enhance"
+tags:
+- Java
+- Agent
+- Tracing
+- thread
+---
+
+When using skywalking java agent, people usually propagate context easily. 
They even do not need to change the business 
+code. However, it becomes harder when you want to propagate context between 
threads when using ThreadPoolExecutor. 
+You can use the RunnableWrapper in the maven artifact 
org.apache.skywalking:apm-toolkit-trace. This way you must change 
+your code. The developer manager usually don't like this because there may be 
lots of projects, or lots of runnable code. 
+If they don't use skywalking some day, the code added will be superfluous and 
inelegant.
+
+Is there a way to propagate context without changing the business code? Yes. 
+
+Skywalking java agent enhances an instance by add a field and implement an 
interface. The ThreadPoolExecutor is a special
+class that is used widely. We even don't know when and where it is loaded. 
Most JVMs do not allow changes in the class
+file format for classes that have been loaded previously. So skywalking can 
not always enhance the ThreadPoolExecutor 
+properly. However, we can apply advice to the ThreadPoolExecutor#execute 
method and wrap the Runnable param using our 
+own agent, then enhance the wrapper class by skywalking java agent. An advice 
do not change the layout of a class.
+
+Now we should decide how to do this. You can use the RunnableWrapper in the 
maven artifact 
+org.apache.skywalking:apm-toolkit-trace to wrap the param, but you will face 
another problem. This RunnableWrapper 
+has a plugin whose active condition is checking if there is @TraceCrossThread. 
Byte buddy in
+skywalking will use 
net.bytebuddy.pool.TypePool.Default.WithLazyResolution.LazyTypeDescription to 
find the annotations
+of a class. The LazyTypeDescription finds annotations by using a 
URLClassLoader with no urls if the classloader is
+null(bootstrap classloader). So it can not find the @TraceCrossThread class 
unless you change the LocationStrategy of
+skywalking java agent builder.
+
+In [this project](https://github.com/libinglong/skywalking-threadpool-agent), 
I write my own wrapper class, 

Review comment:
       Some issues of your codes
   1. System.out is used, 
https://github.com/libinglong/skywalking-threadpool-agent/blob/main/src/main/java/net/bird/listener/TransformListener.java#L43
   2. You are not shading anything, so, users could face bytebuddy conflict.
   3. You are declaring, SkyWalking 7, which is not suitable, and where do you 
need SkyWalking agent? 
https://github.com/libinglong/skywalking-threadpool-agent/blob/main/pom.xml#L14

##########
File path: content/blog/2021-02-04-skywalking-trace-threadpool/index.md
##########
@@ -0,0 +1,41 @@
+---
+title: "Apache SkyWalking: How to propagate context between threads when using 
ThreadPoolExecutor"
+date: 2021-02-04
+author: "Binglong Li"
+description: "This post introduces how to propagate context between threads 
when using ThreadPoolExecutor, 
+which skywalking agent can not enhance"
+tags:
+- Java
+- Agent
+- Tracing
+- thread
+---
+
+When using skywalking java agent, people usually propagate context easily. 
They even do not need to change the business 
+code. However, it becomes harder when you want to propagate context between 
threads when using ThreadPoolExecutor. 
+You can use the RunnableWrapper in the maven artifact 
org.apache.skywalking:apm-toolkit-trace. This way you must change 
+your code. The developer manager usually don't like this because there may be 
lots of projects, or lots of runnable code. 
+If they don't use skywalking some day, the code added will be superfluous and 
inelegant.
+
+Is there a way to propagate context without changing the business code? Yes. 
+
+Skywalking java agent enhances an instance by add a field and implement an 
interface. The ThreadPoolExecutor is a special
+class that is used widely. We even don't know when and where it is loaded. 
Most JVMs do not allow changes in the class
+file format for classes that have been loaded previously. So skywalking can 
not always enhance the ThreadPoolExecutor 

Review comment:
       Not `can not`, is `should not`

##########
File path: content/blog/2021-02-04-skywalking-trace-threadpool/index.md
##########
@@ -0,0 +1,41 @@
+---
+title: "Apache SkyWalking: How to propagate context between threads when using 
ThreadPoolExecutor"
+date: 2021-02-04
+author: "Binglong Li"
+description: "This post introduces how to propagate context between threads 
when using ThreadPoolExecutor, 
+which skywalking agent can not enhance"
+tags:
+- Java
+- Agent
+- Tracing
+- thread
+---
+
+When using skywalking java agent, people usually propagate context easily. 
They even do not need to change the business 
+code. However, it becomes harder when you want to propagate context between 
threads when using ThreadPoolExecutor. 
+You can use the RunnableWrapper in the maven artifact 
org.apache.skywalking:apm-toolkit-trace. This way you must change 
+your code. The developer manager usually don't like this because there may be 
lots of projects, or lots of runnable code. 
+If they don't use skywalking some day, the code added will be superfluous and 
inelegant.
+
+Is there a way to propagate context without changing the business code? Yes. 
+
+Skywalking java agent enhances an instance by add a field and implement an 
interface. The ThreadPoolExecutor is a special
+class that is used widely. We even don't know when and where it is loaded. 
Most JVMs do not allow changes in the class
+file format for classes that have been loaded previously. So skywalking can 
not always enhance the ThreadPoolExecutor 
+properly. However, we can apply advice to the ThreadPoolExecutor#execute 
method and wrap the Runnable param using our 
+own agent, then enhance the wrapper class by skywalking java agent. An advice 
do not change the layout of a class.
+
+Now we should decide how to do this. You can use the RunnableWrapper in the 
maven artifact 
+org.apache.skywalking:apm-toolkit-trace to wrap the param, but you will face 
another problem. This RunnableWrapper 
+has a plugin whose active condition is checking if there is @TraceCrossThread. 
Byte buddy in
+skywalking will use 
net.bytebuddy.pool.TypePool.Default.WithLazyResolution.LazyTypeDescription to 
find the annotations

Review comment:
       ```suggestion
   has a plugin whose active condition is checking if there is 
@TraceCrossThread. Agent core uses 
net.bytebuddy.pool.TypePool.Default.WithLazyResolution.LazyTypeDescription to 
find the annotations
   ```

##########
File path: content/blog/2021-02-04-skywalking-trace-threadpool/index.md
##########
@@ -0,0 +1,41 @@
+---
+title: "Apache SkyWalking: How to propagate context between threads when using 
ThreadPoolExecutor"
+date: 2021-02-04
+author: "Binglong Li"
+description: "This post introduces how to propagate context between threads 
when using ThreadPoolExecutor, 
+which skywalking agent can not enhance"
+tags:
+- Java
+- Agent
+- Tracing
+- thread
+---
+
+When using skywalking java agent, people usually propagate context easily. 
They even do not need to change the business 
+code. However, it becomes harder when you want to propagate context between 
threads when using ThreadPoolExecutor. 
+You can use the RunnableWrapper in the maven artifact 
org.apache.skywalking:apm-toolkit-trace. This way you must change 
+your code. The developer manager usually don't like this because there may be 
lots of projects, or lots of runnable code. 
+If they don't use skywalking some day, the code added will be superfluous and 
inelegant.
+
+Is there a way to propagate context without changing the business code? Yes. 
+
+Skywalking java agent enhances an instance by add a field and implement an 
interface. The ThreadPoolExecutor is a special
+class that is used widely. We even don't know when and where it is loaded. 
Most JVMs do not allow changes in the class
+file format for classes that have been loaded previously. So skywalking can 
not always enhance the ThreadPoolExecutor 
+properly. However, we can apply advice to the ThreadPoolExecutor#execute 
method and wrap the Runnable param using our 
+own agent, then enhance the wrapper class by skywalking java agent. An advice 
do not change the layout of a class.
+
+Now we should decide how to do this. You can use the RunnableWrapper in the 
maven artifact 
+org.apache.skywalking:apm-toolkit-trace to wrap the param, but you will face 
another problem. This RunnableWrapper 
+has a plugin whose active condition is checking if there is @TraceCrossThread. 
Byte buddy in
+skywalking will use 
net.bytebuddy.pool.TypePool.Default.WithLazyResolution.LazyTypeDescription to 
find the annotations
+of a class. The LazyTypeDescription finds annotations by using a 
URLClassLoader with no urls if the classloader is
+null(bootstrap classloader). So it can not find the @TraceCrossThread class 
unless you change the LocationStrategy of
+skywalking java agent builder.
+
+In [this project](https://github.com/libinglong/skywalking-threadpool-agent), 
I write my own wrapper class, 
+and simply add a plugin with a name match condition.
+
+Finally, note you should add your own agent after the skywalking agent since 
the wrapper class should not be loaded before

Review comment:
       ```suggestion
   Finally, note you should add this agent after the skywalking agent since the 
wrapper class should not be loaded before
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to