Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2.x #7649

Closed
wants to merge 3 commits into from
Closed

2.2.x #7649

wants to merge 3 commits into from

Conversation

zhangyinhao1234
Copy link
Contributor

@zhangyinhao1234 zhangyinhao1234 commented Feb 9, 2021

添加了一个sdk,用来创建线程池,和创建runable,参考Spring的Async的实现方式,使用自己创建的runable和线程池实现了多线程链路的显示,原来这块在代码在1.8.3版本上运行,已经稳定运行1年。

@CLAassistant
Copy link

CLAassistant commented Feb 9, 2021

CLA assistant check
All committers have signed the CLA.

@zhangyinhao1234
Copy link
Contributor Author

zhangyinhao1234 commented Feb 9, 2021

example:

<dependency> <groupId>com.navercorp.pinpoint</groupId> <artifactId>pinpoint-java-sdk</artifactId> <version>2.2.2-SNAPSHOT</version> </dependency>

`
private ThreadPoolExecutor triggerPool = new AsyncThreadPoolExecutor(
32,
256,
60L,
TimeUnit.SECONDS,
new LinkedBlockingQueue(1000));

@GetMapping("/hello1")
public String test11(String name) throws InterruptedException {
    String hello = helloService.hello();
    triggerPool.execute(new AsyncRun() {
        @Override
        public Object asyncRun() {
            String pp = helloService.hello2(name, "PP");
            return pp;
        }
    }.getRunnable());
    return hello;
}


@GetMapping("/hello2")
public String test12(String name) throws InterruptedException, ExecutionException {
    String hello = helloService.hello();
    Future pp = triggerPool.submit(new AsyncRun() {
        @Override
        public Object asyncRun() {
            String pp = helloService.hello2(name, "PP");
            return pp;
        }
    }.getCallable());
    return hello;
}

`

image

image

@zhangyinhao1234
Copy link
Contributor Author

日志中未发现提示错误的地方。。不清楚哪里出了错

@emeroad
Copy link
Member

emeroad commented Feb 9, 2021

Please use English.

If there is a lot of log from travis, the build will fail.

Could you push PR to master branch.
The master branch uses github action, so there is no such problem.

@zlp1992
Copy link

zlp1992 commented Feb 25, 2021

@zhangyinhao1234 @emeroad what's the difference between pinpoint-java-sdk and the existed thread plugin(since Pinpoint 2.0.2) ? I think the purpose of both is same, just to keep tracing in aysnc thread. Using thread plugin we don't have to modify business application, while using pinpoint-java-sdk we have to modify our business application to support async trace (for example, use AsyncRun in our code) ?

@emeroad
Copy link
Member

emeroad commented Feb 25, 2021

The thread-plugin operates on global state, making it difficult to limit specific targets.
On the other hand, SDK can also have high accuracy.

For example, SDK makes it very easy to select a specific action when there are multiple asynchronous actions in a method.

@zlp1992
Copy link

zlp1992 commented Feb 25, 2021

Get it. But using SDK we will have to modify our application code ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants