我正在使用Dropwizard Metrics库来记录各种操作在我的应用程序中执行的时间,使用 aTimer
和 theConsoleReporter
以及记录count
,等到mean rate
控制台很好。
我希望这些数字也可以在 /metrics servlet 上使用,并且基于http://metrics.dropwizard.io/3.1.0/manual/servlets/我需要访问名为com.codahale.metrics.servlets.MetricsServlet.registry
. 但是查看文档和代码,我看不出这是如何完成的。我现有的 /metrics 仅输出 dropwizard 和 jetty 类的计时器
[编辑]
private static final MetricRegistry metricRegistry = new MetricRegistry();
...
Timer timer = metricRegistry.timer(name("com.codahale.metrics.servlets.MetricsServlet.registry","testval"));
如何将我的计时器连接到 /metrics 的输出?