apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.52k stars 26.43k forks source link

dubbo MetricsFilter 获取不到线程池统计数据 #8140

Closed welcc closed 2 years ago

welcc commented 3 years ago

Environment

Steps to reproduce this issue

  1. 部署新版dubo-admin
  2. 在dubbo provider开启metric filter dubbo:
    provider: filter: metrics metrics: protocol: dubbo port: 20880
  3. 在dubbo-admin服务统计能够获取服务调用统计数据,但是获取不到线程池统计数据

问题原因排查: 1.查看dubbo源码(org.apache.dubbo.monitor.dubbo.MetricsFilter)发现获取线程池统计数据实现过程是这样的,从DataStore中获取线程池,然后获取线程池数据: private List getThreadPoolMessage() { DataStore dataStore = ExtensionLoader.getExtensionLoader(DataStore.class).getDefaultExtension(); Map<String, Object> executors = dataStore.get(EXECUTOR_SERVICE_COMPONENT_KEY); ... } 2.但是在 https://github.com/apache/dubbo/commit/2484877189c89e12c0ff67504838b702153aa016#diff-45baf3c442a606b31ed84241935cf0cbc571a532cad96bf9b27b4365fb1f0db6 (Reduce context switching cost by optimizing thread model on consumer …)这次commit中去掉了将创建的线程池放入DataStore中的代码: image

image

3.改为用org.apache.dubbo.common.threadpool.manager.DefaultExecutorRepository存储线程池: image

这样导致MetricsFilter中获取线程池监控数据的逻辑失效。

4.并且DefaultExecutorRepository中存储线程池的容器为private,没有提供外部获取方式,只能通过getExecutor(URL url) 获取 image 但是这个根据url获取线程池的方式在MetricsFilter无法使用

laddcn commented 3 years ago

I have fixed this bug yet. Please help me for review.

ilaotan commented 2 years ago

这货都开始标识过期了,也没写替代的类,哎

chickenlj commented 2 years ago

Observability under construction in 3.1.x version, progresses will be updated there.