【发布时间】:2016-10-27 08:53:34
【问题描述】:
我想使用 DropWizard 中的 Guage 指标来监控我的线程池大小。
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
2,
2,
1,
TimeUnit.MINUTES,
new ArrayBlockingQueue<Runnable>(100),
new ThreadPoolExecutor.DiscardPolicy());
metricRegistry.register(name(ThreadPoolExecutor.class, "ThreadPoolRemainingCapacity"), (Gauge<Integer>) () -> threadPoolExecutor.getQueue().remainingCapacity());
metricRegistry.register(name(ThreadPoolExecutor.class, "ThreadPoolOccupiedCapacity"), (Gauge<Integer>) () -> threadPoolExecutor.getQueue().size());
return threadPoolExecutor;
据我了解,这是在间隔时间内自动完成的。但似乎我没有得到我注册指标的任何监控数据。尽管我的应用程序中的其他指标(例如计数器和计时器)工作正常。
谁能帮我弄错地方?
谢谢。
【问题讨论】:
-
您的指标寄存器来自哪里?您如何报告?
标签: java dropwizard gauge