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

关于线程池监控的一个PR #60

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

RobertoHuang
Copy link
Contributor

线程池指标监控采集的Timer内置的HistogramImpl的Reservoir类型为EXPONENTIALLY_DECAYING

如果强制要求Reservoir类型为EXPONENTIALLY_DECAYING感觉不太合理,因为作为指标采集方来说我可能更加关注的是线程池每分钟处理业务的耗时峰值,最小值,平均值等,所以希望通过重载Timer的构造方法实现由业务方决定Reservoir的类型。并且我希望在采集线程池的时候修改指标级别或者添加一些自定义TAG,所以新加了个重载的构造方法

@codecov-io
Copy link

codecov-io commented Apr 10, 2020

Codecov Report

Merging #60 into master will decrease coverage by 0.04%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #60      +/-   ##
============================================
- Coverage     34.51%   34.47%   -0.05%     
- Complexity     1325     1326       +1     
============================================
  Files           215      215              
  Lines         13908    13924      +16     
  Branches       1135     1135              
============================================
- Hits           4801     4800       -1     
- Misses         8784     8801      +17     
  Partials        323      323              
Impacted Files Coverage Δ Complexity Δ
...etrics/instrument/InstrumentedExecutorService.java 23.30% <0.00%> (-4.29%) 5.00 <0.00> (ø)
...rics/reporter/bin/StructMetricManagerReporter.java 65.07% <0.00%> (-2.39%) 14.00% <0.00%> (-1.00%)
...l/src/main/java/com/alibaba/metrics/Striped64.java 60.18% <0.00%> (+0.92%) 11.00% <0.00%> (+1.00%)
...om/alibaba/metrics/reporter/opentsdb/OpenTsdb.java 56.52% <0.00%> (+2.17%) 7.00% <0.00%> (+1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6c4f9b...bbe5380. Read the comment docs.

@ralf0131
Copy link
Collaborator

很好的建议,这里面有不少重复的代码,能否尽量把逻辑都统一到这个方法里面:

public InstrumentedExecutorService(final ExecutorService delegate, final MetricRegistry registry, final String name, final Map<String, String> metricTags, final MetricLevel metricLevel, final ReservoirType reservoirType)

其他的构造函数都来调用这个函数。

@RobertoHuang
Copy link
Contributor Author

好的 我认为线程池监控还有一些额外的参数需要并且可以监控,后续我会调整该PR哈

@RobertoHuang
Copy link
Contributor Author

构造函数复用已经修改

同时我认为为了更好的反应线程池负载可以添加以下指标采集【最大线程池数量,核心线程池数量,线程池当前线程数量,线程池当前活跃线程数量,线程池任务队列大小】。在开发过程中大部分的线程池都是基于ThreadPoolExecutor来创建的,应该可以满足大部分的需求

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.

3 participants