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

[Enhancement] ThreadPoolAdapterState related optimization #1385

Open
zjHe opened this issue Jul 7, 2023 · 5 comments
Open

[Enhancement] ThreadPoolAdapterState related optimization #1385

zjHe opened this issue Jul 7, 2023 · 5 comments

Comments

@zjHe
Copy link
Contributor

zjHe commented Jul 7, 2023

Demand advice

Please answer these questions before submitting them. Thank you.

Is your function request related to the problem?

是的

Describe the function you want

目前适配器线程池的运行数据采集意义不大,目前了解到是因为有些框架线程API加了锁,会影响性能,所以没采集。

image

我们项目内部使用适配器线程大多是自己重写适配器来满足适配,我们可以自己植入线程池当时的运行状况数据到ThreadPoolAdapterState对象当中,但目前ThreadPoolAdapterState对象无预留字段,如果我们要达到目的,需要更改client的ThreadPoolAdapterState增加参数、填充参数数据,并且在AdapterThreadPoolMicrometerMonitorHandler实现上,把数据上报,对客户端重新打包。

是否hippo可以预留这部分参数,并且在AdapterThreadPoolMicrometerMonitorHandler数据上报。这样我们只需要修改适配器注入自己的bean就可以

@Createsequence
Copy link
Collaborator

Createsequence commented Jul 12, 2023

我理解一下,你们现在遇到的问题是:

  • getActiveCount 这样的数据由于考虑到性能问题所以没有进行采集,但是你们可能确实又需要,因此你们想要通过实现自己的 ThreadPoolAdapter 解决这个问题;
  • 由于 ThreadPoolAdapterState 没有预留此类参数属性,因此光替换 Adapter 不能解决问题,你们还需要额外的修改并替换 ThreadPoolAdapterState,然后修改 AdapterThreadPoolMicrometerMonitorHandler 以便上报其他参数;

所以你们希望:如果要新增指标字段,最好可以不需要替换 ThreadPoolAdapterState 实现,也不需要修改 AdapterThreadPoolMicrometerMonitorHandler ?

@zjHe
Copy link
Contributor Author

zjHe commented Jul 13, 2023

由于hippo提供的适配器不太适合我们,所以ThreadPoolAdapter是我们自己实现的注入的。
目前我们希望是:ThreadPoolAdapterState这个类预留一些字段,并且在AdapterThreadPoolMicrometerMonitorHandler里把预留的字段也上报一下(由hippo这边实现,我们不更改hippo的代码)。这样我们只需要更改我们的适配器,将信息填充到ThreadPoolAdapterState里面,就可以上报了吧?@ Createsequence

@Createsequence
Copy link
Collaborator

由于hippo提供的适配器不太适合我们,所以ThreadPoolAdapter是我们自己实现的注入的。 目前我们希望是:ThreadPoolAdapterState这个类预留一些字段,并且在AdapterThreadPoolMicrometerMonitorHandler里把预留的字段也上报一下(由hippo这边实现,我们不更改hippo的代码)。这样我们只需要更改我们的适配器,将信息填充到ThreadPoolAdapterState里面,就可以上报了吧?@ Createsequence

我理解了,这样的话,是不是最好 ThreadPoolAdapterState 可以支持动态字段,然后 AdapterThreadPoolMicrometerMonitorHandler 可以自动将全部有值的属性都上报?不知你们这边是否已经有方案呢,有兴趣也可以提个 PR 。

@zjHe
Copy link
Contributor Author

zjHe commented Jul 19, 2023

由于hippo提供的适配器不太适合我们,所以ThreadPoolAdapter是我们自己实现的注入的。 目前我们希望是:ThreadPoolAdapterState这个类预留一些字段,并且在AdapterThreadPoolMicrometerMonitorHandler里把预留的字段也上报一下(由hippo这边实现,我们不更改hippo的代码)。这样我们只需要更改我们的适配器,将信息填充到ThreadPoolAdapterState里面,就可以上报了吧?@ Createsequence

我理解了,这样的话,是不是最好 ThreadPoolAdapterState 可以支持动态字段,然后 AdapterThreadPoolMicrometerMonitorHandler 可以自动将全部有值的属性都上报?不知你们这边是否已经有方案呢,有兴趣也可以提个 PR 。

好的,之后的java-agent版本会有1.5.0PR的内容吗?

@Createsequence
Copy link
Collaborator

我们会尽可能的保留原有的功能,不过目前也不能完全保证不会因为代码调整导致部分功能无法兼容。 @zjHe

@yanrongzhen yanrongzhen changed the title ThreadPoolAdapterState预留参数 [Enhancement] ThreadPoolAdapterState related optimization Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants