pinpoint-apm / pinpoint-plugin-sample

Pinpoint(https://github.com/naver/pinpoint) profiler plugin sample
69 stars 41 forks source link

Sample12 Async trace AsyncInitiatorInterceptor seems useless #34

Open zlp1992 opened 3 years ago

zlp1992 commented 3 years ago

Hi, In Sample12 async trace, it says we should intercept a method initiating an async task and create/record a new AsyncContext, so it intercepts TargetClass12_AsyncInitiator's method asyncHello then intercepts TargetClass12_Worker constructor method to get theAsyncContext passed by AsyncInitiatorInterceptor. My question is why not create/record a new AsyncContext in the TargetClass12_Worker constructor method interceptor, since TargetClass12_Worker's constructor method is executed in current thread while it's run method executed in another thread, So we can remove AsyncInitiatorInterceptor.

zlp1992 commented 3 years ago

Anyone knows?